D
Damian
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
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