Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Word - add new document from a password-protected template

1 view
Skip to first unread message

Luigino

unread,
Jul 15, 2009, 5:00:15 AM7/15/09
to
Hello everyone,

I'm trying to create automatically a new document from a password-
protected template in Word..
I tried with CreateObject("Word.Application") then:

ActiveDocument = WordDocuments.OleFunction("Add", OleVariant
(pathfiletemplatetoopen), false, 1);
ActiveDocument.OlePropertySet("PasswordTemplate", OleVariant
(password));

but when word opens asks the user to insert password manually...
I tried previously using TWordApplication but I kept getting errors
with:

WordApp->Documents->Open(OleVariant(_document_to_open),
OleVariant(false),
OleVariant(true),
OleVariant(false),
OleVariant
(EmptyStr),
OleVariant
(password),
OleVariant(false),
OleVariant
(EmptyStr),
OleVariant
(password),
EmptyParam,
OleVariant(false),
OleVariant(false));

but Word 2003 VBA Help says Open's method has 4 more parameters which
TWordApplication's Open doesn't have so it returns error.... maybe I
missed something?....

At the end, I would open the document without showing the user neither
asking the user to insert password.... do you know a way to do it?...

Thanks to everyone for this little help!
Ciao,
Luigi

0 new messages