Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
fscodave fscodave is offline
external usenet poster
 
Posts: 11
Default Assign field to a variable

I wish to assign a field to a document variable and then "massage" the
variable in VBA. That way the massaged variable can be inserted into
the main document where needed.

Thanks.

David

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Assign field to a variable

Hi Fscodave,

I wish to assign a field to a document variable and then "massage" the
variable in VBA. That way the massaged variable can be inserted into
the main document where needed.

In the mail merge FAQ on my website you'll find a section on Word
2002/2003, and in there a discussion about using the mail merge events.
There's a sample file that demonstrates basically what you need to do
(manipulate the value of the merge field and put it in the document)

http://homepage.swissonline.ch/cindy...002/MM2002.htm

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 :-)

  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
fscodave fscodave is offline
external usenet poster
 
Posts: 11
Default Assign field to a variable

Thanks. Mark, in a message on Sept. 2, had asked something similar, so
I posted your answer to him. Hope that's not a breach of netiquette. I
then tried to figure out what was going on. I don't know much about
VBA, admittedly, and I see some dreaded "SQL" bits in your macro. When
I ran the merge, I only got the first 2 records to show up, but I did
see the initials for the 2 records that did work (the first two). Oh
well, and not to be grumpy, honest, but WP had relatively simple merge
commands to do that directly as part of the merge (see my admittedly
grumpy riposte in that thread that Mark started, and Peter Jamieson
telling me to cool it). I know, I know, move on, forget about it, but
still...

Anyway, thanks very much. Maybe in a few months of VBA study I'll be
able to understand everything you did. Very impressive, in any event.

Cindy M. wrote:
Hi Fscodave,

I wish to assign a field to a document variable and then "massage" the
variable in VBA. That way the massaged variable can be inserted into
the main document where needed.

In the mail merge FAQ on my website you'll find a section on Word
2002/2003, and in there a discussion about using the mail merge events.
There's a sample file that demonstrates basically what you need to do
(manipulate the value of the merge field and put it in the document)

http://homepage.swissonline.ch/cindy...002/MM2002.htm

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 :-)


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Assign field to a variable

Hi Fscodave,

When
I ran the merge, I only got the first 2 records to show up

You might check that code for a line with .Execute in it (as
in document.MailMerge.Execute). See if it's followed by
"false". I thought I updated the example, but maybe not...

FWIW, this appears to be a resource issue, which is probably
why Peter doesn't sugget this approach very often. On some
machines, it processes everything. Others get only one
record. I went 'round with Microsoft on this and they simply
can't reproduce the problem. But they seem to firmly believe
that setting this parameter to "false" should fix it.

And yes, I came from WordPerfect to Word over 15 years ago.
Mail merge is really the one thing MS just can't seem to
understand or get right sigh. Depending on the
requirements, I

1. Create an Access report

2. Pre-process the data in the data source

3. Use VBA instead of mail merge

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
:-)

  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
fscodave fscodave is offline
external usenet poster
 
Posts: 11
Default Assign field to a variable


Well, happily, our organization is going to call in a bunch of experts.
Project size etc. unknown, but they'll be able to figure out what can
and can't be done. Anyway, it's been a trip trying to figure this stuff
out!

fscodave out

Reply
Thread Tools
Display Modes

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mailmerge - Firstname truncate to Initial?... Mark Mailmerge 9 September 6th 06 04:03 PM
Word: IF statement to merge a field only if another Field is popul HelenC Mailmerge 3 August 24th 06 10:33 AM
Suppressing Merge Field and text before/after julie Microsoft Word Help 8 November 14th 05 02:50 PM
Page x of y problems Cowtoon Microsoft Word Help 7 March 15th 05 04:28 PM
Text Form Field Ref in Footer Won't Update on Screen StarWine Microsoft Word Help 3 December 6th 04 06:17 PM


All times are GMT +1. The time now is 11:33 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"