I'm using a Word template where users complete some standard information.
Here's the current process which works fine:
1. User opens "Template.dot" (via double-clicking)
2. MS Word opens with temp document name "Document1"
3. User complete three fields (Date, Name, Description)
4. User clicks on command button "Copy Me!"
5. User selects file location and specifies new file name.
Again, above process works as envisioned and does NOT require "tweaking". Here's however where I need some help with. Let's say the user named the new Word document "Test.doc".
When the newly created replica document, the macro code (see below) is also included in this document. I don't want that (reason for that is not important here).
Instead, when the user double-clicks on the .dot file (which temporarily generates "Document1") and then clicks the command button, I want the new file (e.g., Test.doc) to NOT include any macro code.
Thus, my question... as part of the document replication, what function can be built into the template that not only deletes the code below but also "itself"? That is, if a new VBA function is required to delete the code below, I also need to delete the DELETE function. Again, the "Test.doc" shouldn't contain any VBA code once saved.
How can this be accomplished? [Attached is the current "Template.dot" file.]
Private Sub CommandButton1_Click()
Dim doc As Document
Set doc = ActiveDocument
'Allows user to specify folder location and file name