Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word/Excel Mail Merge Error 1

Status
Not open for further replies.

osera

Technical User
May 15, 2006
35
US
Good afternoon.

I created a Word template with a macro to perform a mail merge from an Excel file. Everything works perfectly on my computer.

However, when I open the template on a co-workers computer (the template is stored on a network drive) and run the macro, I am getting Run Time Error 5535 on the .Execute command that completes the merge.

Any suggestions will be greatly appreciated.
 



Hi,

Is your drive maping identical?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
No. I haven't fought that battle yet in this office. However, I did take that into account and changed the code when I opened the template on my co-workers computer.

The macro doesn't have a problem on the .OpenDataSource line, so I'm pretty sure I have that part right.
 


Please post your macro.

Usually will better better results for VBA in forum707.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Dim MergeDate As String
Dim ConfirmPrint As String

MergeDate = InputBox("Enter date on data file (yyyymmdd)", "Merge File Date")

ActiveDocument.MailMerge.OpenDataSource Name:= _
"T:\OUT_OPS\Mail_Merge_Docs\MergeFile" & MergeDate & ".xls" _
, ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=T:\OUT_OPS\Mail_Merge_Docs\MergeFile" & MergeDate & ".xls;Mode=Read;Extended Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet" _
, SQLStatement:="SELECT * FROM `DataDump$`", SQLStatement1:="", SubType:= _
wdMergeSubTypeAccess
ConfirmPrint = MsgBox("Print Letters", vbOKCancel, "Print")
If ConfirmPrint = 1 Then
ActivePrinter = "\\hcs084vsnbpf002\DHS_F14H13_LXT654"
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = 1
.LastRecord = 3
End With
.Destination = wdSendToPrinter
.SuppressBlankLines = True
.Execute Pause:=False
End With
End If
 



could it be
Code:
    ActivePrinter = "\\hcs084vsnbpf002\DHS_F14H13_LXT654"
does the user have a printer added for this?

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Brilliant! When she asked me to have it sent to that printer, I assumed she was already connected. I set her up on that printer and it worked just like it should!

Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top