Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #17   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Word mailmerge - Visual Basic experts please help!

objMMMD is just a "label" assigned to a document object which by the command

Set objMMMD = objApp.Documents.Open (FileName: = strDocName, etc )

is being set to the document with the file name of strDocName, which I
believe is your mailmerge main document.

having done that, you can refer to that document by the label that is
assigned to the object.

There is nothing special about the MMMD other than it conveys some meaning
as you have deduced to the use of a person reading the code

You could just as well have used:

Dim doc as Object
Set doc = objApp.Documents.Open (FileName: = strDocName, etc )

but then doc does not convey as much intelligence to the user, other than it
probably refers to a document, but which one.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Murray Muspratt-Rouse" wrote
in message ...[color=blue][i]

While thanking Peter and Doug for their advice I have to say that I have
a major problem - I am not sure what objMMMD is. Does it stand for Mail
Merge Main Document or something like that? If so is it meant to be
used to identify the document set up with merge fields, so as to make
it possible to close it without closing the result of the merge or
whatever? If I am right then I think I understand what I must do to use
it in the VBA code.

Also, because the References pop-up only shows me the first character
of the module name (C:\Program Files\Common Files\Microsoft
Office\OFFICE12\M) I do not whether one of the 12 dlls i can see is the
right one!

Murray

Doug Robbins - Word MVP;360024 Wrote:[color=green][i]
See Peter's previous message in which he says to use

Set objMMMD = objApp.Documents.Open (FileName: = strDocName, etc )

Probably all that you really need of that command is:

Set objMMMD = objApp.Documents.Open (FileName: = strDocName,
AddToRecentFiles:=False )

And that is on the assumption that you do not want the document to be
added
to the list of most recently used files.

If that is not an issue, you can simply use

Set objMMMD = obj.App.Documents.Open(strDocName)

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Murray Muspratt-Rouse"
wrote
in message
...

I think I have overcome the Tools/References problem, but now I have
another one: - I get an compile error message telling me that End of
Statement was expected, highlighting FileName in the statement to
which
I have added 'Set objMMMD ='

Set objMMMD = objApp.Documents.Open FileName:=strDocName,
ConfirmConversions:=False, _
ReadOnly:=False, AddToRecentFiles:=False _
, PasswordDocument:="", _
PasswordTemplate:="", Revert:=False, WritePasswordDocument:="",
_
WritePasswordTemplate:="", XMLTransform:=""

Murray

Peter Jamieson;359803 Wrote:
That is probably because the Word Object library has not been
referenced
via
the Tools|References option in Access VBA. However, the original
author
may
have avoided that deliberately because when you reference a library,
the
reference is to a specific version of Word.

You can typically work around that using the following instead (you
just
don't see the autocomplete Help in the VBA editor that you would
otherwise
get)

Dim objMMMD As Object

--
Peter Jamieson
http://tips.pjmsn.me.uk

"Murray Muspratt-Rouse"
wrote
in message ...-

Thank you Doug for referring me to Peter Jamieson's advice. I have
immediately run in to a problem - it does not like 'objMMMD As
Word.Document' telling me 'User-defined type not defined' and
suggesting that it might be in a properly registered object or type
library. Did I misunderstand Peter's advice? Was I meant to change
objMMMD to something else?

Murray



+-------------------------------------------------------------------+
+-------------------------------------------------------------------+



--
Murray Muspratt-Rouse



 
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
Word Visual Basic ksawb Microsoft Word Help 1 November 5th 07 10:33 AM
Visual Basic through Word help 4a4i4163211 Microsoft Word Help 0 October 2nd 07 05:22 PM
Problem with Visual Basic A in Word PJay Microsoft Word Help 1 April 9th 07 11:47 AM
MailMerge using Visual Basic ActiveX ref Mailmerge 2 February 1st 07 06:11 PM
How do I stop Visual Basic Macros from word? RobSlattery Microsoft Word Help 4 July 9th 05 07:26 AM


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