I have a program that automatically generates a Excel .CSV file and a PDF file of some data. The CSV file and the worksheet name have the same name as the name of the PDF. For instance, if the CSV name is MyDatabase123 then the worksheet name will also be MyDatabase123, this is the same name as the PDF. The only difference in the two is the file extension. The user is supposed to have both the CSV and the PDF open at the same time.
Is there a way to have Excel activate the PDF and save to the certain file path (P:\Job Packets)?
Is there a way to have Excel activate the PDF and save to the certain file path (P:\Job Packets)?
VBA Code:
Sub Button1_Click()
Dim CurrFileName As String, PDFname As String, NewFileName As String
CurrFileName = ActiveSheet.Name
PDFname = CurrFileName + ".pdf"
NewFileName = Range("D6")
Windows(PDFname).Activate
'Save PDF as NewFileName
End Sub