Print pdf without grid

erutherford

Active Member
Joined
Dec 19, 2016
Messages
366
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>
 

Some videos you may like

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

jondavis1987

Active Member
Joined
Dec 31, 2015
Messages
304
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]
 

erutherford

Active Member
Joined
Dec 19, 2016
Messages
366
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!
 

jondavis1987

Active Member
Joined
Dec 31, 2015
Messages
304
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,096,304
Messages
5,449,561
Members
405,571
Latest member
Flux1234

This Week's Hot Topics

Top