Hello,
1. I need to know how to use save as to save and rename a file on my desktop using string variables. I want the name of the file to be MerchantName (a string variable, whose name is taken from a cell in the excel document) and MerchantDate (a string variable that will be the prior month of this year; with only month and year, no day; so it would be 2/15 for example). These excel files are being stored in a folder and I need to differentiate them by Merchant name and Month of sale.
I tried to use this code: ActiveWorkbook.SaveAs "MyFile.xls" and converted it to: Activeworkbook.SaveAs MerchantName & MerchantDate & ".xls" but it is not working. I need the correct syntax here....
2. I am creating this for my business, so it will be saved as a PDF file on different computers with different users. I see in the code when I save the file using a Macro that the following code appears.
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\Jeremiah\Desktop\Master.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
If the user changes (from Jeremiah) to another username, will the code run incorrectly? How do I create an ambiguous name in the code? I may be able to cut it down to be run on only one computer with one user; but in that case I would need to change the: "C:\Users\Jeremiah\Desktop\Master.pdf" to "C:\Users\"NAME OF USER"\Desktop\Master.pdf". Correct?
Please let me know. Thank you,
Jeremy
Bookmarks