I am trying to create a reference in code using:

AddIns.Add FileName:= _
"C:\Test.dot", Install:=True
ActiveDocument.UpdateStylesOnOpen = False

ThisDocument.VBProject.References.AddFromFile "C:\Test.dot"
'***PROBLEM CODE

The reference will be created and works fine, but I am always prompted
for a TemplateSuite password on Document_New and Document_Open. The
first section of code that adds the AddIn works fine.

Since I am generating a reference to a file in code when my VBA
Project is locked and password protected, I continually get prompted
for a password. The only time I am able to get the system to work
seemlessly is by unlocking the VBA Project; however, this leaves my
VBA Project This Document code open for viewing by our users.

I am also able to cancel the TemplateSuite Password prompt and the
document with the new built reference opens fine.

Thanks for any leads!!!

Daniel

Re: Help in VBA Password Properties when creating reference by Word

Word
Wed Oct 01 05:46:58 CDT 2003

G'day dhayden@uda1.com (Mr. Daniel Hayden),

Hmmm... have you tried an Application.DisplayAlerts=wdAlertsNone ???


dhayden@uda1.com (Mr. Daniel Hayden) was spinning this yarn:

>I am trying to create a reference in code using:
>
>AddIns.Add FileName:= _
> "C:\Test.dot", Install:=True
> ActiveDocument.UpdateStylesOnOpen = False
>
>ThisDocument.VBProject.References.AddFromFile "C:\Test.dot"
>'***PROBLEM CODE
>
>The reference will be created and works fine, but I am always prompted
>for a TemplateSuite password on Document_New and Document_Open. The
>first section of code that adds the AddIn works fine.
>
>Since I am generating a reference to a file in code when my VBA
>Project is locked and password protected, I continually get prompted
>for a password. The only time I am able to get the system to work
>seemlessly is by unlocking the VBA Project; however, this leaves my
>VBA Project This Document code open for viewing by our users.
>
>I am also able to cancel the TemplateSuite Password prompt and the
>document with the new built reference opens fine.
>
>Thanks for any leads!!!
>
>Daniel

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email steve@wordheretic.com
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.