I have created the following Macro: taking a worksheet from a workbook and saving it to desktop as "Customer Copy" excel file and then saving the "Customer Copy" excle file as a PDF file also on desktop, then closing both files.
This works fine on my PC, the trouble I have is when I give this main workbook to others and they try to run the file they get an error Message, the usual End or Debug. My Macro is:
Sub Macro1()
'
' Macro1 Macro
'
'
Sheets("Output Summary").Select
Sheets("Output Summary").Copy
ChDir "C:\Users\hardeep.sidhu\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\hardeep.sidhu\Desktop\Customercopy.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\hardeep.sidhu\Desktop\Customercopy.pdf", Quality:=xlQualityStandard _
, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
ActiveWindow.Close
End Sub
The error on a colleagues screens is on line:
ChDir "C:\Users\hardeep.sidhu\Desktop"
I need to replace my name Hardeep Sidhu with anyone using running the macro (i.e active user on their PC)
Please can someone help fix the above code. I don't really understand any of this language.
Kind Regards
Hardeep
Bookmarks