0

I am having difficulty saving Each PDF in a specific folder for various users on our network. I want the code to save a PDF version of the worksheet in this location: Macintosh HD ▸ Users ▸ (Specific Username Saving the PDF) ▸ Dropbox ▸ Froghair ▸ QB Invoices

This is the code I have so far, I cannot get it to save anything. Any help is greatly appreciated. Thanks in advance!

ActiveSheet.PageSetup.PrintArea = Range("A1:G90")

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:="C:Macintosh 
HD\Users\" & Environ$("Username") & "\Dropbox\Froghair\QB Invoices" & 
ThisWorkbook.Name & "Invoice " & Range("F6").Text & "_copy", 
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
stark
  • 13
  • 1
  • 2

2 Answers2

0

I am not really across Macs but don't you need a \ after C: when you specify the filename?.

Possibly you need one after QB Invoices too as I am not sure if that is the start of the filename or if it is a folder?

Also does the Mac have the same environment variables as Windows? I am not 100% sure that this will work the way it does in Windows.

Dan Donoghue
  • 6,056
  • 2
  • 18
  • 36
  • Thanks for the response. I do not enjoy programming on a Mac, I have been changing the file path and got rid of the "C:\" and I can get it to my desktop. The problem I am having is retrieving the Username of the User to save it on their computer. Any suggestions? – stark Mar 04 '15 at 21:46
0

Try changing Environ$("Username") to Environ("Username") instead. Where did the $ come from?. I would just save to the root folder to see if that works. If it does, then your path is incorrect.

simon tan
  • 34
  • 1
  • 9
  • I am not sure if I used the "Filename" function correctly. Should I use "Filename" or should it be a different code? – stark Mar 04 '15 at 21:57
  • https://msdn.microsoft.com/en-us/library/bb238907(v=office.12).aspx shows the function without commas. Try that. – simon tan Mar 04 '15 at 23:20