AutoSave using specific cell(s) to rename and to a specific location

LIZZYD

New Member
Joined
Jan 20, 2017
Messages
1
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!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top