List Info

Thread: Re: Mail merge between Access and Word - using VB-6




Re: Mail merge between Access and Word - using VB-6
country flaguser name
United States
2007-02-20 10:43:06
Hi Bruce.

I got a useful reply from an Access MSN group I belong to.

Here's what the person there said:
=================
1 Open your database, and select the table or query whose
data you 
want to embed in a

Word document.

2 Choose Office Links from the Tools menu, and then choose
Merge It 
with Microsoft

Office Word from the submenu (or select the same command
from the 
drop-down list

of the toolbar's Office Links button). This starts the
Microsoft Word 
Mail Merge Wizard.

3 Select the option to link to an existing Word document or
the 
option to create and link

to a new document. If you choose to embed the data in an
existing 
document, the

wizard will display a dialog box in which you specify the
document 
location. When

you finish, click OK.

4 The wizard starts Word and activates a mail merge link
back to your 
table or query.
===============

I think I can figure it out from there - record a macro, and
let the 
VBA do the rest.

Richard

--- In helpwithvb@yahoogroups.com, "Neiger, Bruce
D" 
<Bruce.D.Neiger...> wrote:
>
>  
> Again. I don't know the Word Object model well enough
to give you 
specifics -- but I do know that all of the MS Office
programs expose 
such a model -- so, you need to find the correct object(s0
and their 
properties to manipulate.
>  
> Anyone here know how to get at the mail merge
functionality and 
help Richard out?
>  
> 
> >Integrating the concepts from each of his books
would, of course 
> >yield a more complete application. 
> 
> "I'm not sure about that - His LTP Examples book
has nothing to do 
> with the project developed in the other three volumes
of his VB-6 
set."
> 
> You may be right... However, I was speaking about using
the skills 
picked up from the databases book, along with Objects and
the 
examples.,... not the specifics.
>  
> -=BDN=-
> 
> ________________________________
> 
> From: helpwithvb@yahoogroups.com on behalf of Richard
> Sent: Mon 2/19/2007 11:14 PM
> To: helpwithvb@yahoogroups.com
> Subject: [helpwithvb] Re: Mail merge between Access and
Word - 
using VB-6
> 
> 
> 
> Bruce:
> 
> The following hit the nail on the head:
> 
> "How do I use the mail merge functionality /
fields from VB6?" 
> 
> That's exactly what I am trying to do in my combination

> Objects/Database China Shop project. I might also try a
couple of 
> Access lists I belong to to answer that question. But
since the 
> books' author is the moderator of this list, I thought
I would try 
> here first.
> 
> Your comment
> 
> >Integrating the concepts from each of his books
would, of course 
> >yield a more complete application. 
> 
> I'm not sure about that - His LTP Examples book has
nothing to do 
> with the project developed in the other three volumes
of his VB-6 
set.
> 
> Richard
> 
> --- In helpwithvb@yahoogroups.com
<mailto:helpwithvb%
40yahoogroups.com> , "Neiger, Bruce D" 
> <Bruce.D.Neiger> wrote:
> >
> > I do recall, now
> > Your thought is a good one. Each of the LTP books
tries (and, 
> imho succeeds) at imparting the concepts that it
focuses on. 
> Integrating the concepts from each of his books would,
of course 
> yield a more complete application. 
> > 
> > So... is your question: "How do I take this
extended macro and 
> store the order information in the database" or
"How do I use the 
> mail merge functionality / fields from VB6?" If
the former, I (or 
> many others) can help guide you... I fear I don't know
much about 
the 
> part of object model that deal with mail merge, however
-- though 
> I'll wager someone on this list does. I do know that
you can find 
> the object model itself online on the msdn pages on the
ms site.
> > 
> > Storing the order data in a(n) .mdb file should
just follow the 
> techniques you learn in the databases book.
> > 
> > DAO is, indeed the older technology -- that does
NOT make it 
> obsolete. It was optimized for Jet spaces (Access
databases -- Jet 
> is the actual database management system part of Access
-- really, 
> when you think of it, Access is "just" the
front end part... visual 
> table creation and querying tools, table modeler,
tools, reports, 
> forms, lotsa good stuff of course, but all bells and
whistles 
against 
> he RDMBS itself, which is Jet). 
> > 
> > DAO works well (yes, currently) -- and I (will)
continue to use 
it 
> when I code in VBA or VB6 against a Jet space.
Occasionally I will 
> find myself using ADO, these days, as in when (rarely)
I find 
myself 
> coding in VB6 / VBA against an SQL Server Express
database, or 
other 
> source. But I have been doing DAO so long that I hardly
ever need 
to 
> look up any syntax anymore... So why quit? Well, maybe
Office 2007 
> or some later version will abandon DAO, and I will have
to.. I hope 
> not, though.
> > 
> > hth
> > -=BDN=-
> > 
> > ________________________________
> > 
> > From: helpwithvb@yahoogroups.com
<mailto:helpwithvb%
40yahoogroups.com>  on behalf of Richard
> > Sent: Mon 2/19/2007 5:47 PM
> > To: helpwithvb@yahoogroups.com
<mailto:helpwithvb%
40yahoogroups.com> 
> > Subject: [helpwithvb] Re: Mail merge between
Access and Word - 
> using VB-6
> > 
> > 
> > 
> > Hi Bruce
> > 
> > If you've read Prof. Smiley's books, you'll
understand why I want 
> to 
> > do it this way. He uses the Word objects in the
object library to 
> > print an invoice from inside the VB environment
generated app. I 
> > wanted to enhance the invoice by customizing it
using the mail 
> merge 
> > fields from the database. In his objects book, he
records a Macro 
> > and converts it to VBA in Word 97 to generate the
actual 
document, 
> > then copies it into the VB-6 IDE and makes
modifications to 
> generate 
> > the document from within the VB-IDE generated
program. I am 
working 
> > on that, but wanted to personalize the document a
little more 
than 
> > the one generated in the Objects textbook. His
document starts 
> > out "Dear SIR OR MADAM: This is to confirm
your order...", and in 
> > this version, he doesn't save the order to the MDB
file. In the 
> > Databases book (the fourth in the series) he
doesn't do anything 
> with 
> > the objects from the third book. (I have his
complete VB-6 series 
> on 
> > a shelf right next to my computer.)
> > 
> > One more question: DAO vs. ADO...I noticed that
you keep 
> referencing 
> > DAO (the older database access technology, if I'm
not mistaken). 
> Can 
> > I still do DAO if I'm using Access 2002? or would
I have to 
convert 
> > the database to a previous version? (Access 2002
has the 
capability 
> > to convert to Access 2k or Access 97).
> > 
> > Richard
>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://grou
ps.yahoo.com/group/helpwithvb/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://
groups.yahoo.com/group/helpwithvb/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:helpwithvb-digest@yahoogroups.com 
    mailto:helpwithvb-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    helpwithvb-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

RE: Re: Mail merge between Access and Word - using VB-6
country flaguser name
United States
2007-02-20 12:56:01
I would not have thought of this approach -- for the simple
reason that it uses a macro to manipulate the menus.  My
thinking was along the lines of finding the object model for
the mail merge itself.
 
The approach suggested would work, of course, but it might
turn out to be a "bit wooden"... as you are
essentially telling VBA to follow a set of keystrokes,
rather than manipulating the mail merge "object"
directly.  It could be a little bit like hiring a technician
to do the work, and then aping his movements in a repeat,
later, rather than figuring out what (s)he actually did, and
then doing that yourself.
 
Where's the downside?  Copying keystrokes may not work as
well on a different machine, if the setup is slightly
different, and, without the ability to manipulate the
objects yourself, you might not be able to figure out what
went wrong.
 
Also... What you can accomplish through VBA, using the
object model, you can do through VB6... the same is not
true, necessarily (or in the same manner) if you are just
sending keystrokes.
 
That having been said, the VBA recorder often invokes the
object itself, rather than just sending keystrokes... so you
might get some really good insights into the solution I
actually suggested... record and then view the macro... See
what objects it invokes, and in what order, and with what
parameters... then spend some time with the VBA help on
those objects... You may end up with the best of both
worlds.
 
 
Let me know how it turns out.
 
-=BDN=-
________________________________

From: helpwithvb@yahoogroups.com on behalf of Richard
Sent: Tue 2/20/2007 10:43 AM
To: helpwithvb@yahoogroups.com
Subject: [helpwithvb] Re: Mail merge between Access and Word
- using VB-6



Hi Bruce.

I got a useful reply from an Access MSN group I belong to.

Here's what the person there said:
=================
1 Open your database, and select the table or query whose
data you 
want to embed in a

Word document.

2 Choose Office Links from the Tools menu, and then choose
Merge It 
with Microsoft

Office Word from the submenu (or select the same command
from the 
drop-down list

of the toolbar's Office Links button). This starts the
Microsoft Word 
Mail Merge Wizard.

3 Select the option to link to an existing Word document or
the 
option to create and link

to a new document. If you choose to embed the data in an
existing 
document, the

wizard will display a dialog box in which you specify the
document 
location. When

you finish, click OK.

4 The wizard starts Word and activates a mail merge link
back to your 
table or query.
===============

I think I can figure it out from there - record a macro, and
let the 
VBA do the rest.

Richard


.
 
 


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://grou
ps.yahoo.com/group/helpwithvb/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://
groups.yahoo.com/group/helpwithvb/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:helpwithvb-digest@yahoogroups.com 
    mailto:helpwithvb-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    helpwithvb-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

  
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )