* Automating Process 
Author Message
 * Automating Process

Hi all,

I am a newbie in Word 97.  Could someone show me how to write a VBA program
to do the following:

- Given a directory called C:\mybook.
- I have a number of *.PCX scanned image files.

1. File->New document
2. Go to C:\mybook, find out how many and the names of the *.PCX files.
3.  For each *.PCX file, do the following
    a.    simulate Insert menu->Picture->From File..., programmatically
select the current file
    b.    insert this PCX file into the existing Word document.
    c.    insert a page break after the PCX image so that the next image
will appear on the next page of the document.
    d.    continue this loop until no more files to be processed in
C:\mybook.

Could someone help me with this VBA program?

Thanks.



Wed, 16 Oct 2002 03:00:00 GMT  
 * Automating Process
Hi Jay,

Try tackling this program on step at the time. You may use the macro
recorder to get the code necessary to insert the picture into the
document. Same way, the creation of a page break.

Try that, and have a look at the code. This will give you an idea how
you can write a program in VBA. It will not yet be optimal, but that
can be arranged at a later stage.

Also, use the Help-file extensively. This gives extra information about
the commands. Put the cursor on a keyword, and press F1. That will
bring up a Help-item.

The last thing you'll need for this program is the For Each Next loop
construction. Look it up in the Help file. This lets you cycle through
all the items in a list (a subdirectory in your case) without having to
know how many items there are.

Give it a try!

Richard (NL)



Quote:
> Hi all,

> I am a newbie in Word 97.  Could someone show me how to write a VBA
program
> to do the following:

> - Given a directory called C:\mybook.
> - I have a number of *.PCX scanned image files.

> 1. File->New document
> 2. Go to C:\mybook, find out how many and the names of the *.PCX
files.
> 3.  For each *.PCX file, do the following
>     a.    simulate Insert menu->Picture->From File...,
programmatically
> select the current file
>     b.    insert this PCX file into the existing Word document.
>     c.    insert a page break after the PCX image so that the next
image
> will appear on the next page of the document.
>     d.    continue this loop until no more files to be processed in
> C:\mybook.

> Could someone help me with this VBA program?

> Thanks.

Sent via Deja.com http://www.deja.com/
Before you buy.


Wed, 16 Oct 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Automate Process

2. can VB automate processes?

3. isolating if/then statements - automate process?

4. Automating the Setup Process

5. Automating Account Creation Process?

6. Automated file name processing...

7. Automate right-click...Properties...Hide process

8. Automating a repetitive process in Excel

9. How to automate multi-programs processing in Win 2K Professional (like Batch for DOS)

10. how to automate an ftp process ?

11. Automate address book import process?

12. Automated the process of generating exe!

 

 
Powered by phpBB® Forum Software