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

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
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,215,433
Messages
6,124,861
Members
449,194
Latest member
HellScout

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