Hi,
I am trying to make the following steps work but Step 5 (macro) simply does not work.
Step 1 I have a worksheet where a user is able to enter data in one tab,
Step 2 which is stored in another tab by way of macros,
Step 3 which populates cells in another tab,
Step 4 the cells will then populate the footers of several word/ppt documents acting as a unique watermark in a seperate hidden folder.
Step 5 When the user hits save in excel, save the word/ppt documents as PDFs in a folder which has the file name similar to the entered data
I am clueless how to create a macro to save ppt documents as PDFs and also a macro to generate a folder with file name similar to the entered data
My macro code is as such (For the macro text in red, I get the error Run-time error '5' Invalid procedure call or argument):
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim oWord As Object
Dim oDoc As Object
Set oWord = CreateObject("Word.Application")
Set oDoc = oWord.Documents.Open("T:\Watermarked document\1.doc")
oDoc.ExportAsFixedFormat OutputFileName:="T:\1. doc", _
ExportFormat:=wdExportFormatPDF
oWord.Quit
Set oWord = Nothing
Thank you very much for helping!
Best Regards,
Victor
I am trying to make the following steps work but Step 5 (macro) simply does not work.
Step 1 I have a worksheet where a user is able to enter data in one tab,
Step 2 which is stored in another tab by way of macros,
Step 3 which populates cells in another tab,
Step 4 the cells will then populate the footers of several word/ppt documents acting as a unique watermark in a seperate hidden folder.
Step 5 When the user hits save in excel, save the word/ppt documents as PDFs in a folder which has the file name similar to the entered data
I am clueless how to create a macro to save ppt documents as PDFs and also a macro to generate a folder with file name similar to the entered data
My macro code is as such (For the macro text in red, I get the error Run-time error '5' Invalid procedure call or argument):
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim oWord As Object
Dim oDoc As Object
Set oWord = CreateObject("Word.Application")
Set oDoc = oWord.Documents.Open("T:\Watermarked document\1.doc")
oDoc.ExportAsFixedFormat OutputFileName:="T:\1. doc", _
ExportFormat:=wdExportFormatPDF
oWord.Quit
Set oWord = Nothing
Thank you very much for helping!
Best Regards,
Victor