shahdelsol
Active Member
- Joined
- Jul 21, 2009
- Messages
- 276
- Office Version
- 365
- Platform
- Windows
I am trying to save a file to a folder on a desktop without knowing what username is and I came up with this code but it doesn't work. Can anyone correct me? Thanks
VBA Code:
Sub SaveAsPDF()
Dim myloc As String
myloc = "C:\Users\" & Environ("username") & "\desktop\" & " \ books \ """
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"myloc" & ActiveSheet.Range("J1").Value & " " & ActiveSheet.Range("C10").Value & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
End Sub