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 / December 2003

Tip: Looking for answers? Try searching our database.

Open word from IE breaks mailmerge

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Damian - 11 Dec 2003 00:27 GMT
Hi I have been trying to open word from IE with asp.net
finnally broke down and had to do it with asp. Well now I
can open it, but when the initial macro runs it cannot
find the mailmerge file CMS.dqy. When I run the template
on the server it works just fine.. I tried even mapping a
drive. Any thoughts? is this possible? here is my macro

Sub Document_Open()
DoMerge
End Sub

Sub DoMerge()
   
   Dim GetUserName As String
   GetUserName = Application.UserName
   Set DocNew = Documents.Add
 
 ActiveDocument.MailMerge.MainDocumentType =
wdFormLetters
 ActiveDocument.MailMerge.OpenDataSource
Name:="O:\CMS.dqy", _
 ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
 AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
 WritePasswordDocument:="", WritePasswordTemplate:="",
Revert:=False, _
 Format:=wdOpenFormatAuto, _
 SQLStatement:="SELECT * FROM vMailMerge"
 ActiveDocument.MailMerge.EditMainDocument
 ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:="3 Day Letter"
 ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:=GetUserName
 With ActiveDocument.MailMerge
   .Destination = wdSendToNewDocument
   .MailAsAttachment = False
   .MailAddressFieldName = ""
   .MailSubject = ""
   .SuppressBlankLines = True
       With .DataSource
           .FirstRecord = wdDefaultFirstRecord
           .LastRecord = wdDefaultLastRecord
       End With
       .Execute
   End With

End Sub
Peter Jamieson - 11 Dec 2003 10:05 GMT
As far as I know you will never be able to do a mailmerge if the .doc is
open within IE - attempts to use many of the properties and methods of the
ActiveDocument.Mailmerge and ActiveDocument.MailMerge.DataSource object will
result in error 4605 "...method or property is not available because the
document is in another application". I think to do the merge, you will at
least have to ensure the .doc opens in a standalone instance of Word. If you
manage that, the data source must either be accessible via a Windows
netwrking path (cf. your mapped drive) or via an ODBC connection string. It
cannot be located at a URL such as http://xyz/cms.dqy.

--
Peter Jamieson - Word MVP

> Hi I have been trying to open word from IE with asp.net
> finnally broke down and had to do it with asp. Well now I
[quoted text clipped - 44 lines]
>
> End Sub

Rate this thread:






 
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.