File path issue gets tougher

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
Hello I have this issue here and I need help :

Code:
Sub pdfCreate  ()
Dim FolderPath As String 
FolderPath = ThisWorkbook.Path & "\PDF FILES"
ChDir ThisWorkbook.Path & "\PDF FILES"
Sheet10.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Sheet10.Range("F4").Text, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False 
End Sub

I want the files saved in that pdf files folder yet it keeps saving it in the documents folder.

I am sure I am messing up with something but can't see it yet.

Point that out for me please.

Thanks in advance
Kelly
 
I am now understanding what tricked me previously:

The path follows where a previous file saved went. So before , I was lured to believe the script was doing what I wanted it to do. Because after saving to the pdf files folder, I tried using the previous code and now it's working. Lol
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Code:
  Sheet10.ExportAsFixedFormat Type:=xlTypePDF, _
                              Filename:=ThisWorkbook.Path & "\PDF FILES\" & Sheet10.Range("F4").Text, _
                              Quality:=xlQualityStandard, _
                              IncludeDocProperties:=True, _
                              IgnorePrintAreas:=False, _
                              OpenAfterPublish:=False



Hello @shg, and anyone seeing this;

I need yet another help here:

Inside that "pdf files " folder, I want to let my script create Sub folders in there from the text in sheet10.Range("B17").Text.

So first scan that folder(pdf files) to see if there is a folder there same as the text in sheet10 cell B17. If there is, then just create the pdf files inside it else create that folder then create pdf files inside. I got stacked in the process please help. :confused:

Thanks
Kelly
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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