Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / November 2003

Tip: Looking for answers? Try searching our database.

Email Merge Displays a dialog Choose Profile

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Moschella - 19 Nov 2003 21:16 GMT
I can do a Mail Merge and then send it out as email
without any problem as long as Outlook is running.  If I
do not have Outlook Running it brings up a dialog titled
Choose Profile (with a selection "MS Exchange Settings").  
I tried opening up an instance of Outlook.Application but
that did not help.  Is there some setting I can set in the
Outlook.Application object or the Word.Doc.MailMerge object
to "MS Exchange Setting" so this dialog will not show ?
Do I need to always startup the Outlook.exe?The
MAPI.Session object has something called Logon
ProfileName, can I set this some place in either of these
two objects?

I am running Word 2000 and Outlook 2000 on Windows 2000
using vb6 to write the code.  
See code below

Thanks
Mike

Private WithEvents mOut As Outlook.Application
Private WithEvents mWrd As Word.Application
Private WithEvents mDoc As Word.Document

Private Sub cmdGenerate_Click()
On Error GoTo eh
           bNew = False
           Set mWrd = CreateObject("Word.Application")
           
           If Not (bNew) Then
               Set mDoc = mWrd.Documents.Open
("C:\MailMerge\Demo\TempTemplate.doc")
           Else
               Set mDoc = mWrd.Documents.Add
           End If
           
           If Not (bNew) Then
                      mDoc.MailMerge.MainDocumentType =
wdFormLetters
               mDoc.MailMerge.OpenDataSource
Name:="C:\MailMerge\Demo\data1.dat"
           End If
           Set mOut = CreateObject("Outlook.Application")
           
           mWrd.Visible = True
           mWrd.Activate
           Screen.MousePointer = vbDefault
           mDoc.MailMerge.MailAsAttachment = True
           mDoc.MailMerge.MailAddressFieldName
= "Email_Address"
           mDoc.MailMerge.MailSubject = "GreatTest"
           mDoc.MailMerge.Destination = wdSendToEmail
           mDoc.MailMerge.Execute
       
   Set mMsg = Nothing
   Set mOut = Nothing
   Unload Me
   Exit Sub

eh:
   Unload Me

End Sub
Peter Jamieson - 20 Nov 2003 11:33 GMT
I doubt if you will get a definitive answer in this group and you probably
need to ask in an Outlook group, but from experiments here I think you are
probably on the right lines, e.g. if you were using VBA you might have

Dim oa As Outlook.Application
Dim ons As Outlook.NameSpace
Set oa = CreateObject("Outlook.Application")
Set ons = oa.GetNamespace("MAPI")
ons.Logon "the profile name", "", False, False
With ActiveDocument.MailMerge
 .Execute
End With
ons.Logoff
Set ons = Nothing
Set oa = Nothing

This seems to work whether or not Outlook is running, but I don't know what
happens if for example you need to ensure that you log on to the same
profile as Outlook is using.

--
Peter Jamieson - Word MVP

> I can do a Mail Merge and then send it out as email
> without any problem as long as Outlook is running.  If I
[quoted text clipped - 59 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.