Solved

creating a word document by WordApplication with custom template

Posted on 2009-07-08
9
681 Views
Last Modified: 2013-11-17
Hello everyone,

anyone could suggest me how I can create a new word document from a custom template authenticated by user/password with WordApplication not visible so I can update only two places automatically then saving in another folder and printing as PDF?.....

Thanks to all!
Ciao,
Luigi
0
Comment
Question by:npuleio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
9 Comments
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 24813507
What language are you trying to write this program in?  
0
 

Author Comment

by:npuleio
ID: 24813708
Hello,

I use C++ Builder...
0
 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 24813894
Then you should be in that application zone. I will move the question for you.  I doubt if you're going to get any answers in the Word forum.

Joanne Orzech
MS Word MVP
EE Zone Advisor
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 37

Expert Comment

by:Joanne M. Orzech
ID: 24814389
Oh my apologies evilrix!  And my thanks for straightening this out....

Joanne
0
 
LVL 40

Expert Comment

by:evilrix
ID: 24815713
>> thanks for straightening this out
No worries, my pleasure.
0
 

Author Comment

by:npuleio
ID: 24839184
At least, anyone knows why if I write:

WordApplication->ActiveDocument->Shapes->AddTextEffect(msoTextEffect1, "text", "Arial Black", 1, msoFalse, msoFalse, 0, 0)

C++ Builder couldn't find a match?...
0
 

Author Comment

by:npuleio
ID: 24851162
OK here I am... I did some investigations and tests around Word.Application....

I have a template .dot which has read-password and write-password... how I would set the wordapplication as here:

WordDoc = WordDocs.OleFunction("Add", OleVariant(path_of_template_name.dot,...)

to pass automatically passwords?....
If I do

WordDoc = WordDocs.OleFunction("Add", OleVariant(path_of_template_name.dot,false, 1);
then
WordDoc.OlePropertySet("PasswordTemplate") = passwordtemplate;
WordDoc.OlePropertySet("WritePasswordTemplate") = passwordtemplate;

indeed executing OleFunction(...), Word opens and asks me directly the password instead of executing OlePropertySet... how I can figure that out?...

Thanks
Ciao
Luigi
0
 

Accepted Solution

by:
npuleio earned 0 total points
ID: 25273618
I've figured the solution at end:

since I was using PDFCreator which is an external component, I created a COM object with Delphi:

    PDFCreator := CreateOLEObject('PDFCreator.clsPDFCreator');

so I can set options of PDFCreator like password as in this example:

    PDFCreator.cOption('PDFOwnerPasswordString') := ownerpass;
    PDFCreator.cOption('PDFUserPasswordString') := ownerpass;

where ownerpass is a parameter variable passed by calling code, so that solved my issue. Hope that'd be useful to everyone...there's a complete Delphi example in PDFCreator sample though..

Thanks again to all.
Ciao
Luigi
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question