Reply
 
Thread Tools Display Modes
  #1   Report Post  
Robert
 
Posts: n/a
Default VB6 and Word question

Hi,

I need some hints for the following problem.

I have a VB 6 application that needs to write data (text and image) to a
Ms-Word document (template)

So I created a Ms-Word document with some bookmarks. The VB App is able to
write the data to the Ms-Word document and save it with a new doc-name.
But.this works only for one page. How to deal with a multiple page document.

So the user of my application can create his/her own Word document
(template) and can choose every lay-out they wish as long as they insert the
obligatory fields.
My application uses this Word document (template), fills in the fields and
saves it with a new documentname.
But beforehand it's unknown how much pages the application needs. The
Microsoft Word document (template) contains only one page with the
obligatory fields.
So if the fields are filled, how to create the next page with the same
lay-out, .... read obligatory fields.

Is mail merge an option, and if so how to create such a Ms-Word document.

I hope you understand what i intend. My excuses but English is not my native
language.

Robert



  #2   Report Post  
Peter Jamieson
 
Posts: n/a
Default

I think your main choices a
a. do not use mail merge. Always start from the initial document, then for
each record in your data source
- copy/paste the initial document into an intermediate document
- insert your data and pictures into the intermediate document
- copy the intermediate document and append it to the output document
- clear or delte the intermediate document
b. use mail merge.
- create a new data source from the data in your VB6 program
- use OpenDataSource to connect the initial document to that data source
- perform the merge
- do any necessary postprocessing on the output document (which is the
ActiveDocument after the merge.

Before you use (b), you need to check that mailmerge is a viable process for
producing the kind of documents you want from the inputs you have. For
example, Mailmerge is not designed to process Parent/child tables to produce
things such as "one invoice with detail lines per customer". If you write
your own merge function, you may get a lot more control, but you have to do
a lot more work, e.g.
- decide how users should define where data should go in their documents
- validate that user markup
- do all the data insertion
- consider what to do about stuff such as headers/footers, other types of
field codes the users might enter (at what point should they be
executed/resolved)

Peter Jamieson
-
"Robert" wrote in message
...
Hi,

I need some hints for the following problem.

I have a VB 6 application that needs to write data (text and image) to a
Ms-Word document (template)

So I created a Ms-Word document with some bookmarks. The VB App is able to
write the data to the Ms-Word document and save it with a new doc-name.
But.this works only for one page. How to deal with a multiple page
document.

So the user of my application can create his/her own Word document
(template) and can choose every lay-out they wish as long as they insert
the
obligatory fields.
My application uses this Word document (template), fills in the fields and
saves it with a new documentname.
But beforehand it's unknown how much pages the application needs. The
Microsoft Word document (template) contains only one page with the
obligatory fields.
So if the fields are filled, how to create the next page with the same
lay-out, .... read obligatory fields.

Is mail merge an option, and if so how to create such a Ms-Word document.

I hope you understand what i intend. My excuses but English is not my
native
language.

Robert





  #3   Report Post  
Robert
 
Posts: n/a
Default

What about using AutoText. Create a new page after the last line and insert
AutoText (AutoText contains the whole page with bookmarks) ?

Robert


  #4   Report Post  
Peter Jamieson
 
Posts: n/a
Default

Can do - jut make sure you clean up and don't leave the user with questions
to do with saving templates.

Peter Jamieson
"Robert" wrote in message
...
What about using AutoText. Create a new page after the last line and
insert
AutoText (AutoText contains the whole page with bookmarks) ?

Robert



  #5   Report Post  
Robert
 
Posts: n/a
Default

Thanks Peter.

"Peter Jamieson" wrote in message
...
I think your main choices a
a. do not use mail merge. Always start from the initial document, then for
each record in your data source
- copy/paste the initial document into an intermediate document
- insert your data and pictures into the intermediate document
- copy the intermediate document and append it to the output document
- clear or delte the intermediate document
b. use mail merge.
- create a new data source from the data in your VB6 program
- use OpenDataSource to connect the initial document to that data source
- perform the merge
- do any necessary postprocessing on the output document (which is the
ActiveDocument after the merge.

Before you use (b), you need to check that mailmerge is a viable process
for producing the kind of documents you want from the inputs you have. For
example, Mailmerge is not designed to process Parent/child tables to
produce things such as "one invoice with detail lines per customer". If
you write your own merge function, you may get a lot more control, but you
have to do a lot more work, e.g.
- decide how users should define where data should go in their documents
- validate that user markup
- do all the data insertion
- consider what to do about stuff such as headers/footers, other types of
field codes the users might enter (at what point should they be
executed/resolved)

Peter Jamieson
-
"Robert" wrote in message
...
Hi,

I need some hints for the following problem.

I have a VB 6 application that needs to write data (text and image) to a
Ms-Word document (template)

So I created a Ms-Word document with some bookmarks. The VB App is able
to
write the data to the Ms-Word document and save it with a new doc-name.
But.this works only for one page. How to deal with a multiple page
document.

So the user of my application can create his/her own Word document
(template) and can choose every lay-out they wish as long as they insert
the
obligatory fields.
My application uses this Word document (template), fills in the fields
and
saves it with a new documentname.
But beforehand it's unknown how much pages the application needs. The
Microsoft Word document (template) contains only one page with the
obligatory fields.
So if the fields are filled, how to create the next page with the same
lay-out, .... read obligatory fields.

Is mail merge an option, and if so how to create such a Ms-Word document.

I hope you understand what i intend. My excuses but English is not my
native
language.

Robert







Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:35 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"