How to execute macro without Opening a word file?

S

Satish Jadhav

Hello,

I have got some other issue....in WordML.

Description :

To auto generate the Table Of Contents (TOC) in WordML I had written a
Macro.
This Macro Updates the Table of Contents when the Word file is opened,
works fine.

But I have a next functionality where I have to pass this Word file to
convert into PDF.

Now the problem is, that the TOC (Table Of Contents) is not updated untill
and unless I open the file (because I have written a Macro "AutoOpen" to
update the TOC).

I'm passing this file to Convert in PDF and after the conversion the TOC
is empty in PDF file. (Converting a Word file to PDF is a back ground
process, where the file should not be opened and as we know without opening a
file the Macros do not get executed)

In PDF the Contents are missing.....

Is it possible to show the TOC in PDF after conversion ?

Regards,
Satish
 
C

Cindy M.

I have got some other issue....in WordML.Tony Jollans has answered this in the long, on-going
discussion with you. The answer is, no, you cannot run
macros without opening the document in Word.

If you need to avoid this, then you'll have no choice but
to parse the XML to generate the TOC in your application.
Word's functionality requires the running Word application.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
S

Satish Jadhav

Cindy M. said:
Tony Jollans has answered this in the long, on-going
discussion with you. The answer is, no, you cannot run
macros without opening the document in Word.

If you need to avoid this, then you'll have no choice but
to parse the XML to generate the TOC in your application.
Word's functionality requires the running Word application.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)


This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)


Hi Cindy,

Yes, you are correct, there is no way that we can run macros without opening
the document in Word.

Therefore I had to use the third party for getting the desired result.

Using the property : oPrintJob = oPrinter.WordPrintJob;
oPrinter.WordPrintJob.EnableAutoMacros = true;

Now it displays the proper and updated Contents of Table in PDF after
conversion.

Thanks a lot for reply.

Warm Regards,
Satish Jadhav
 

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