Arie Bos
Board Regular
- Joined
- Mar 25, 2016
- Messages
- 224
- Office Version
- 365
- Platform
- Windows
I created a new folder 'Apples', and want to save a file in that folder. But my code keeps saving the pdf in the folder in which the new 'Apples' folder was created, and not in the sub-folder 'Apples' itself.
So I tried to put &"\" in fileNameSave between vDir & PDFName, but then a compile error turns up.
Anyone knows how the pdf can be saved one level lower in 'Apples'?
So I tried to put &"\" in fileNameSave between vDir & PDFName, but then a compile error turns up.
Anyone knows how the pdf can be saved one level lower in 'Apples'?
VBA Code:
Public Function vDir() As String
vDir = Environ("userprofile") & "\Documents\Soniq\Sales\" & Range("CompanyName")
End Function
Sub CommandButton1_Click()
fileSaveName = vDir & Range("PDFName")
Sheets("Overview").Select
'Save 'Overview' as PDF
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=vDir & PDFName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
From:=1, To:=1, _
OpenAfterPublish:=False
End Sub