WERNER SLABBERT
Board Regular
- Joined
- Mar 3, 2009
- Messages
- 104
Morning all you smart people...
i have a vba code that saves and prints a document to a folder. i would like to expand it somewhat to ref a cell and then save the doc to the right folder.
currently it just saves to one folder. i need it to look at 'B9' and the find the corresponding folder and if it does not exist create it. the save the doc with the data from two other cells. 'G11 & C11'
the data in "B9' changes to the user need from a drop down from " Quote , Invoice , Job Card & Statement ", G11 & C11 respectively are the customer name and document nr.
i have a vba code that saves and prints a document to a folder. i would like to expand it somewhat to ref a cell and then save the doc to the right folder.
currently it just saves to one folder. i need it to look at 'B9' and the find the corresponding folder and if it does not exist create it. the save the doc with the data from two other cells. 'G11 & C11'
the data in "B9' changes to the user need from a drop down from " Quote , Invoice , Job Card & Statement ", G11 & C11 respectively are the customer name and document nr.
Code:
Sub PrintSave()On Error Resume Next 'In case it already exists
MkDir GetSpecialfolder(CSIDL_DESKTOP) & "\Quotes"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Dim Filename As String
Dim Path As String
Filename = Range("L1").Value
Path = CreateObject("Wscript.Shell").specialfolders("Desktop")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Path & "\Quotes\" & Filename & ".Pdf", Quality:= _
xlQualityMinimum, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub