#1
|
|||
|
|||
Save as both pdf and docx
Hello
I am posting this here as well, as it most likely is VBA-related. I need a way to save the document as both pdf and docx. And also update the pdf when changes has been saved in the doc, instead of making another pdf file. I would prefer to have the two documents in the same location, and to avoid the "do you want to replace"-message, because of the pdf. I would appreciate a solution to this very much! |
#2
|
||||
|
||||
There will be no warning if you save with VBA (at least not in a PC environment). I am not sure if this will translate to the Mac.
Code:
Sub SaveAsDocXandPDF() Dim strPath As String On Error GoTo err_Handler ActiveDocument.Save strPath = Left(ActiveDocument.FullName, InStrRev(ActiveDocument.FullName, ".") - 1) & ".pdf" ActiveDocument.SaveAs2 Filename:=strPath, FileFormat:=wdFormatPDF, AddToRecentFiles:=False lbl_Exit: Exit Sub err_Handler: MsgBox "Document not saved" Resume lbl_Exit End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thanks for the response. What happened when I ran it was that i had to choose location, and then it showed the error message you put in without making a pdf file.
|
#4
|
||||
|
||||
The call to SaveAs2 must not work in the Mac version Change that to SaveAs and see if that works for you.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#5
|
|||
|
|||
Thank you very much, that solved it It still gives the error message even though it actually saves both files, so I just removed it
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Save as both pdf and docx | McHjertholm | Word | 2 | 02-24-2015 01:11 PM |
Save HTML as DOCX | john1 | Word | 1 | 11-21-2014 10:56 PM |
After Word crash, can no longer save as .docx | mrwednesday | Word | 4 | 10-15-2013 01:21 AM |
How can I set *.doc as default save format and NOT *.docx? | pstein | Word | 1 | 01-11-2012 09:30 AM |
Can't Save a file as .docx | the_lil | Word | 5 | 10-27-2011 08:41 AM |