Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The following code is written to allow the user to select the folder where they

ID: 3562518 • Letter: T

Question

The following code is written to allow the user to select the folder where they wish to save a PDF of the worksheet and the file name will consist of data located in cells D4 and D5. It also checks to confirm that the data in cell D5 contains 3 characters. The code works fine but with one issue. If the user drills down say 4 levels of subfolders the file does not save in the folder, it saves in the folder one level up.

I can't figure out why the file is not saved it the folder selected.

Can someone indicate what I am missing?

Thank you

Explanation / Answer

I just copy and paste - but a picture will do. I thought you may have a error in your code and it is easier with actual code.

What happens with

Sub TestMacro()
Dim FldPath As String
Application.FileDialog(msoFileDialogFolderPicker).Show
FldPath = Application.FileDialog(msoFileDialogFolderPicker).SelectedItems(1)
ActiveSheet.ExportAsFixedFormat xlTypePDF, FldPath & "Eng test export.pdf"
End Sub

Hope this helps :D

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote