Hello,
I am new to Macro Scheduler and am looking for a way to convert an excel document to a pdf every morning, without having to be logged onto my computer. Is there any way that this can be done? If so I would love help on the code!
Another issue that I am running into is that the excel file has data from other excel files. In this case every time I open the document I get the pop-up window asking to update links. I want to be able to automate this, but unfortunately when I don't have the original source file open, I get stuck with a lot of #VALUE, so both excel files need to be open. Is there a fix to this?
Thank you
Convert Excel to PDF
Moderators: Dorian (MJT support), JRL
Convert Excel to PDF
Last edited by klneel on Wed Jul 22, 2015 2:41 pm, edited 1 time in total.
Re: Convert Excel to PDF
Does your version of Excel have .PDF as a "save as" option?
Re: Convert Excel to PDF
JRL,
Do you mean the drop down save as tab? In that case yes.
Do you mean the drop down save as tab? In that case yes.
Re: Convert Excel to PDF
No guarantee this will be perfect for you but hopefully it will be close and give you some idea of a way to proceed.
Code: Select all
//Change these three lines to reflect your real file names.
Let>vPDFName=c:\path\vPDFFileName.pdf
Let>vFileMain=c:\path\ExcelFileName.xlsx
Let>vFileDependancy=c:\path\ExcelFileName.xlsx
ExtractFileName>vFileMain,vMain
ExtractFileExt>vFileMain,vExt
StringReplace>vMain,vExt,,vMain
ExtractFileName>vFileDependancy,vDependancy
ExtractFileExt>vFileDependancy,vExt
StringReplace>vDependancy,vExt,,vDependancy
ExecuteFile>vFileMain
ExecuteFile>vFileDependancy
WaitWindowOpen>%vDependancy%*
WaitReady>0
WaitWindowOpen>%vMain%*
WaitReady>0
SetFocus>%vMain%*
Wait>1
Press Alt
Send>fa
Release Alt
Wait>1
Send>b
Wait>1
Press Tab
Wait>1
Send>p
Wait>1
Press shift
Press Tab
Release shift
Send>vPDFName
Wait>1
Press Enter
Let>WW_TIMEOUT=5
WaitWindowOpen>Confirm Save As*
Wait>1
Send>y
Wait>1
Let>WW_TIMEOUT=0
WaitWindowOpen>Publishing...
Wait>1
WaitWindowClosed>Publishing...
Wait>1
SetFocus>%vDependancy%*
Wait>1
Press Alt
Send>f
Wait>1
Send>x
Release Alt
SetFocus>%vMain%*
Wait>3
Press Alt
Send>f
Wait>1
Send>x
Release Alt