save a sheet in pdf with sheet name to specific folder

michellin

Board Regular
Joined
Oct 4, 2011
Messages
56
Office Version
  1. 2019
Platform
  1. Windows
Hi there, i try to found my answer, 2 days i'm trying different solution find everywhere.

But i can't find my need.
Maybe you guys could help me.

I need to save my activesheet in pdf with the activesheetname (date) to a specific folder.
I already got my macro to copy the sheet i need and rename it with the today date.
But i'm not able to save it with sheet name to specific folder in pdf.


Sheets("TEST").Select
Application.CopyObjectsWithCells = True
Sheets("TEST").Copy After:=Sheets(2)
strDate = Format(Date, "yyyy-mm-dd")
With ActiveSheet
.Name = strDate
End With

I would like to save to "C:\TEST"2020-11-10.pdf

Thanks a lot for your help :)
Michellin
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
How about
VBA Code:
   With ActiveSheet
      .Name = strdate
      .ExportAsFixedFormat xlTypePDF, "C:\TEST\" & strdate
   End With
 
Upvote 0
Solution
OMG fluff, i know you guys will have the answer.
so simple.
I was bug with choice, decide to let the path or the name.
In one single line you resolve all my need.
I search too far or too complicated.

OMG you just make my day :)

THANKS YOU FLUFF HAVE A NICE DAY :)
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,580
Messages
6,125,654
Members
449,245
Latest member
PatrickL

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