I am using Excel 2007. I am attempting to generate a Word Document (using a template) using Excel VBA. I have two problems stumping me:
1. I want to create a userform that gives me the option to remove the footer on the document by clicking a checkbox on/off. I know how to create the userform and checkbox, but how do you remove the footer in the Word document programmatically?
When I recorded a macro in Word 2007, it gave me:
Note: The template I am using doesn't have a footer on the cover page. It only exists on all subsequent pages.
2. I also want the userform to provide the option to add a watermark. Word has several pre-sets which I would like to access, such as Confidential, Draft, Sample, etc. All of the examples I found online show how this can be done via Word VBA, something like this:
How would I get this to work via Excel VBA?
Any ideas experts?
1. I want to create a userform that gives me the option to remove the footer on the document by clicking a checkbox on/off. I know how to create the userform and checkbox, but how do you remove the footer in the Word document programmatically?
When I recorded a macro in Word 2007, it gave me:
Code:
WordBasic.RemoveFooter
Note: The template I am using doesn't have a footer on the cover page. It only exists on all subsequent pages.
2. I also want the userform to provide the option to add a watermark. Word has several pre-sets which I would like to access, such as Confidential, Draft, Sample, etc. All of the examples I found online show how this can be done via Word VBA, something like this:
Code:
ActiveDocument.AttachedTemplate.BuildingBlockEntries("CONFIDENTIAL 1").Insert Where:=Selection.Range, RichText:=True
How would I get this to work via Excel VBA?
Any ideas experts?