Excel is changing format when running vba print code

lr1234

New Member
Joined
Feb 9, 2021
Messages
9
Office Version
  1. 365
Platform
  1. Windows
I'm using the code below to print the tabs in my worksheet to PDF, but for reason I can't figure out the formatting of the lines is changing to bold. I dont understand why this is happening. I want it to print like it would when I print manually but I also want to use a code and get it done fast since I have lot of tabs to go through.

Sub PrintPDF()
Dim ws As Worksheet
Path = "T:\some path"
For Each ws In ActiveWindow.SelectedSheets
ws.ExportAsFixedFormat xlTypePDF, Path & "\" & ws.Name & " - RPOTest.pdf"
Next ws
End Sub


This is how it is printing using my code:
1616425595140.png


This is how it prints when I print manually:
1616427300253.png
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
I have seen that too. I think it happens when printing to PDF. I worried too much about it.

I found this article, where Microsoft seems to acknowledge that this happens (not in the original post, but is brought up in a reply by the OP), but didn't really seem to have any good solution:
 
Upvote 0
I have seen that too. I think it happens when printing to PDF. I worried too much about it.

I found this article, where Microsoft seems to acknowledge that this happens (not in the original post, but is brought up in a reply by the OP), but didn't really seem to have any good solution:
It dawned on me while reading your post that I should try to Print to PDF instead of export or save to pdf. I'll try that and let you know if it works.
 
Upvote 0

Forum statistics

Threads
1,214,909
Messages
6,122,189
Members
449,072
Latest member
DW Draft

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