Saving Word Document without Attached macro

X

XmlAdoNewbie

Hi All,
I have created a template with word and VBA that takes all the word
docs in a specific folder and allows a user to open the selected
document for edit, when the user goes to edit the document it opens
the document into another template that i created which has a custom
toolbar attached to it and various VBA commands to control the events
on this toolbar. The problem i am having is when the user presses SAVE
on my custom toolbar, the document saves fine however it also saves
the toolbar and all i want is to save the text changes I DON'T want to
save the attached toolbar.. how do i do this? this is the code i have
for saving in my custom toolbar.

ActiveDocument.SaveAs FileName:=docletPath &
ActiveDocument.ActiveWindow.Caption, FileFormat:=wdFormatDocument

docletPath = "C:\Temp\doclet\"

the following is the code i use to open the word document that was
chosen for editing into the second template with the custom toolbar.

Set docApp = New Word.Application

With docApp
.Visible = True
.WindowState = wdWindowStateMaximize
End With

ActiveDocument.ActiveWindow =
docApp.Documents.Open("C:\_dev\CWBL\PensionDocumentBuilder\Retirement\tempDoclet.dot")

docApp.ActiveDocument.ActiveWindow.Selection.InsertFile
FileName:=docletPath & Me.txtSource.Text
docApp.CommandBars("Menu Bar").Enabled = False
docApp.ActiveDocument.ActiveWindow.Caption = Me.txtSource.Text

docApp.ActiveDocument.ActiveWindow.SetFocus

Thanks in advance for the help.
Erin
 
J

Jonathan West

Hi Erin,

The toolbar and macro is not saved with the document unless you specifically
take measures top transfer them. What is happening is that the document
remains attached to the template where the toolbar and macro reside. if you
open the document on another computer that doesn't have your template, then
you will find that the toolbar and macro aren't there.
 
C

Chad DeMeyer

Instead of moving the document into your template with the toolbar and
macros, why don't you try temporarily adding the template to the user's
add-ins collection and installing it, then uninstall it and remove it from
Add-Ins collection at the end?

Regards,
Chad DeMeyer
 
C

Charles Kenyon

If at the end of your procedures (or in an AutoClose macro) you attach your
ActiveDocument to normal.dot the macros and toolbars should disappear. There
is nothing in your code that would put them into your document.
--
Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://www.addbalance.com/word/index.htm>

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide)
<URL: http://www.addbalance.com/usersguide/index.htm>

Word Resources Page
<URL: http://www.addbalance.com/word/wordwebresources.htm>

See also the MVP FAQ: <URL: http://www.mvps.org/word/> which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top