I have a folder on my desktop with a bunch of subfolders by peoples names (i.e. Subfolder1 = DOE, JOHN; Subfolder2 = SMITH, JOHN, etc.). When I change cell "B2" in the spreadsheet and run the Macro, I would like it to save that sheet as a .pdf to the applicable person's folder that is listed in "B2". Then, when I change names and run it again, it will save it to the next persons folder.
Thanks for any help!
here is what I currently have.
Thanks for any help!
here is what I currently have.
Code:
Sub GeneratePDF()
Dim Path As String
Dim Filename As String
Call SetPrintArea
Path = "K:\10 Quality Assurance\04 Inspection Stamp Log and Authority\03 Weld & Braze Certification Logs" & "\" & ActiveSheet.Range("B2").Value
Filename = ActiveSheet.Range("B3").Value & "-" & ActiveSheet.Range("D3").Value
Application.DisplayAlerts = False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path & " " & ActiveSheet.Range("B3").Value & "-" & ActiveSheet.Range("D3").Value & "-" & ActiveSheet.Range("F3").Value & ".pdf"
Application.DisplayAlerts = True
End Sub
Sub SetPrintArea()
Range("A2:G14").Select
End Sub
Function FolderExists(FolderPath As String) As Boolean
On Error Resume Next
ChDir FolderPath
If Err Then FolderExists = False Else FolderExists = True
End Function