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
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I'm guessing you don't have the path in the cell, so:

Code:
Sheet10.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & Application.Pathseparator & Sheet10.Range("F4").Text, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
 
Upvote 0
I'm guessing you don't have the path in the cell, so:

Code:
Sheet10.ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & Application.Pathseparator & Sheet10.Range("F4").Text, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False


Error :

Object required
 
Upvote 0
ChDir ThisWorkbook.Path & "\PDF FILES"

'I Wana know what this line is doing there, I am thinking that's what is causing the issues maybe
 
Upvote 0
Error :

Object required

There are only 2 objects in that code - Sheet10 and Application. The latter cannot be missing and if your code worked before, Sheet10 must be valid, so I do not see how you could get that error on that line.
 
Upvote 0
Oh okay I think my windows need some updates because most of my scripts are behaving strangely
 
Upvote 0
Hello again, I have done the update but still the script is not running. Can someone help me out with why it's not working.

I want it saved to the "pdf files" folder yet it's saving to the "documents " folder.

Thanks
 
Upvote 0
What is the current code you are using?
 
Upvote 0
what is the filepath of thisworkbook.path if its the documents folder then you need to change the file path and not use thisworkbook.path
 
Upvote 0

Forum statistics

Threads
1,214,886
Messages
6,122,093
Members
449,064
Latest member
Danger_SF

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