#1
|
|||
|
|||
Macro save a form generated from a template
Hi
I have this macro for a command button in my template to save a form (word document when i open the template) after completion of the form. But i encountered run time error 4198 when i tried to run this in the word document generated from the template. Any help is appreciated. Thanks. Code:
Private Sub SaveAsPDF_Click() With Application.FileDialog(msoFileDialogSaveAs) .FilterIndex = 3 .Show If .SelectedItems.Count <> 0 Then ThisDocument.SaveAs2 .SelectedItems(1), wdFormatDocument End If End With End Sub Last edited by elaineAda; 05-05-2022 at 06:32 AM. |
#2
|
|||
|
|||
Code:
ThisDocument Code:
ActiveDocument |
#3
|
|||
|
|||
Thanks a lot! It works. But something else happen.
After added in the activeX command button, all my macro cannot work when i open the template to a document, but within the template, all the macros can work. I then delete the activeX command button and try again, all my macros work. Any idea why i cannot add in an activeX command button. I wanted a button in the tempalte, is there any other way beside the activeX command button? Pl advise me how to go about it. Thanks. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cant save document as docx or doc using macro in Word 2007 | staicumihai | Word VBA | 1 | 04-27-2018 10:59 AM |
File will not save as docx. only doc. | Library Worker | Word | 5 | 01-27-2016 09:40 AM |
Word 2007 , when I save a .doc or .docx file the file type is showing "Empty" | Tomc29 | Word | 9 | 06-10-2015 03:04 AM |
Getting Macro To Work in .docx file on Website | Mhangoy | Word | 6 | 09-06-2013 06:57 AM |
Can't Save a file as .docx | the_lil | Word | 5 | 10-27-2011 08:41 AM |