Noob to VBA here, apologies in advance. Haven't even thought of macros in years, and searched the forum and can't quite piece together the parts to what I need.
I have a spreadsheet for daily jobsite use...completed by the crew and used by internal departments for payroll and billing. Boss is trying to go paper-free (finally!), so I locked it so that the crews (varying levels of computer literacy) can complete the sheet on their tablets rather than hand-writing them. What I need now is for when the crew closes the sheet, it autosaves (or prints to pdf) to a specific location in our dropbox, using three cells to name the file. I'd love for the original to go back to blank also, but I realize that may be stretching it.
Here's what I have so far:
Sub PrintPdf()
strPath = "Y:\TIMESHEETS\CurrentYearDailys"
strFName = Range("H4").Text & " " & Range("D6").Text & " " & Range("D8").Text & ".PDF"
For Each Worksheet In Worksheets
Worksheet.Select
Next
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
strPath & strFName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
(currently saves/prints to our server, that part I can change on my own!)
So this prints the sheet for viewing for billing & payroll, which works wonders...but how do I get it to A..run this process before closing (without prompt, preferably), and B..not overwrite the original spreadsheet at closing, so it is again blank for the next job?
Thanks in advance!
I have a spreadsheet for daily jobsite use...completed by the crew and used by internal departments for payroll and billing. Boss is trying to go paper-free (finally!), so I locked it so that the crews (varying levels of computer literacy) can complete the sheet on their tablets rather than hand-writing them. What I need now is for when the crew closes the sheet, it autosaves (or prints to pdf) to a specific location in our dropbox, using three cells to name the file. I'd love for the original to go back to blank also, but I realize that may be stretching it.
Here's what I have so far:
Sub PrintPdf()
strPath = "Y:\TIMESHEETS\CurrentYearDailys"
strFName = Range("H4").Text & " " & Range("D6").Text & " " & Range("D8").Text & ".PDF"
For Each Worksheet In Worksheets
Worksheet.Select
Next
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
strPath & strFName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
(currently saves/prints to our server, that part I can change on my own!)
So this prints the sheet for viewing for billing & payroll, which works wonders...but how do I get it to A..run this process before closing (without prompt, preferably), and B..not overwrite the original spreadsheet at closing, so it is again blank for the next job?
Thanks in advance!