Print pdf without grid

erutherford

Active Member
Joined
Dec 19, 2016
Messages
449
Here is my existing code. I would like to NOT print the gridlines. I thought I could just add "PrintGridlines:=False", but that didn't work.

<code>
Else
'export to PDF in current folder
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strPathFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
'confirmation message with file info
MsgBox "PDF file has been created: " _
& vbCrLf _
& strPathFile
End If

</code>
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Maybe this?
Code:
[COLOR=#333333][FONT=monospace]Else[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]'export to PDF in current folder
[/FONT][/COLOR][COLOR=#000000][FONT=monospace]wsA.PageSetup.PrintGridlines = [/FONT][/COLOR][FONT=monospace][COLOR=#07704a]False[/COLOR][/FONT]
[COLOR=#333333][FONT=monospace]wsA.ExportAsFixedFormat _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]Type:=xlTypePDF, _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]Filename:=strPathFile, _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]Quality:=xlQualityStandard, _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]IncludeDocProperties:=True, _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]IgnorePrintAreas:=False, _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]OpenAfterPublish:=True[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]'confirmation message with file info[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]MsgBox "PDF file has been created: " _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]& vbCrLf _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]& strPathFile
[/FONT][/COLOR][COLOR=#000000][FONT=monospace]wsA.PageSetup.PrintGridlines = [/FONT][/COLOR][COLOR=#07704A][FONT=monospace]True[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]End If[/FONT][/COLOR]
 
Upvote 0
Thank you. Works perfect. I didn't see anything like this in my searching. "wsa". I'll research the wsa so I know what its doing.
Again thanks for your time!
have a great weekend!
 
Upvote 0
Sorry for the delayed response. Just moved to a new house and haven't had much free time. From what I can gather in your code, wsA is the worksheet you're doing all of this in. So the
Code:
wsA.PageSetup.PrintGridlines = False
goes into the page setup of the worksheet and actually turns off the gridlines. Then in the end of the code the line
Code:
[COLOR=#000000]wsA.PageSetup.PrintGridlines = [/COLOR][COLOR=#07704A]True[/COLOR]
turns the gridlines back on after you've already made the pdf.
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,962
Latest member
Fenes

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