on 11-02-2011 10:18 AM
Hi,
can anyone tell me how can I call a Macro in Worddocument with parameter. I'm trying to insert some MergeFields in needed Position using following marco.
Sub MailMerge(Name As String)
' Add the merge field.
ActiveDocument.MailMerge.Fields.Add _
Range:=Selection.Range, _
Name:=Name
End Sub
and then running this macro in program like this:
call method of wordobj 'MailMergeOpenDataSource'...
call method of wordobj 'MailMergeEditMainDocument' ....
call method of wordobj 'TableInsertTable'...
loop at fields.
call method of wordobj 'NextCell'.
call method of wordobj 'Insert'
exporting
#1 = fields-label.
call method of wordobj 'NextCell'.
call method of wordobj 'ToolsMacro'
exporting #1 = 'MailMerge' " <-- Makroname
#2 = 1 " <-- Run
#??? = Parameter.
endloop.
Thanks a lot.
regards,
sumiya
Hi sumiya
The syntax is as Following:
Application Run Makroname,par1,par2,...
For example
Apllication.Run "mailmerge", "Test1", "e-mail@" ...
greetings
Thomas Br
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.