Problems printing macro PDF output!

JK2900

New Member
Joined
Aug 27, 2014
Messages
1
So I have a strange problem:

My macro exports 2 PDF files to a specific folder and they look perfect on the screen!

However, when I print them the graph looks different. I'll display a picture of "right and wrong" below along with my code.


Code:
Function GetFolder(strPath As String) As String
Dim fldr As FileDialog
Dim sItem As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
    .Title = "Select a Folder"
    .AllowMultiSelect = False
    .InitialFileName = strPath
    If .Show <> -1 Then GoTo NextCode
    sItem = .SelectedItems(1)
End With
NextCode:
GetFolder = sItem
Set fldr = Nothing
End Function




Sub PrintToFile()

Dim fp As String
Dim Active As Worksheet
Dim path As String
Dim filename As String

'Uses GetFolder Function to open file browser
Worksheets("GraphData").Range("R2").FormulaR1C1 = GetFolder("C:\TEST_INITIAL\")


path = Worksheets("GraphData").Range("R2")
filename = Worksheets("GraphData").Range("R3")

fp = path & "\" & filename

'Print Trajectory

Sheets("GraphData").Activate
ActiveSheet.PageSetup.PrintArea = "$K$7:$Z$49"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=fp, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

'Print Well Bore

filenametwo = Worksheets("GraphData").Range("R4")

fpp = path & "\" & filenametwo

Sheets("GraphData").Activate
ActiveSheet.PageSetup.PrintArea = "$J$51:$AA$95"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=fpp, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False


End Sub




BONUS POINTS!!!

I also have a problem when printing this graph from excel (by selecting print area and clicking print). I've attached that picture as well (It shades under the curve).

But when I manually export it to a PDF and Print, it works....



Anyone have any idea why Excel hates me right now?

Thanks,
JK





 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,215
Messages
6,177,172
Members
452,763
Latest member
WH12TTY

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top