It's always usually better to run the code in the calling app then call an
app to run it's code, if that makes sense.
Did you use VBScript code in a custom form? If so, better to use a VBA
Macro using the Outlook VBA Editor and map the macro to a custom toolbar
button on your e-mail form. The error you see will be resolved once you
select the Microsoft Word Object Model in the References dialog in the VBA
Editor.
--
Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog:
http://blogs.officezealot.com/legault/
"Laie" wrote:
Thanks Eric
but i cannot handle the macro it says "Anweisungsende erwartet in line nr
where is:
Dim objDoc As Word.Document, objWApp As Word.Application"
a better way would be maybe to start the macro i have to insert autotext in
word.
macroname is macro 1
Selection.EndKey Unit:=wdStory
'NormalTemplate.AutoTextEntries("Mail Aktuell").Insert Whe=Selection. _
'Range, RichText:=True
'Selection.HomeKey Unit:=wdStory
how to call this macro from OL code???
maybe you can help me again
"Eric Legault [MVP - Outlook]" schrieb im
Newsbeitrag ...
You can use something like the macro below; just change the
AutoTextEntries.Item to the entry you need:
Sub WordMailInsertAutoText()
On Error GoTo EH:
Dim objDoc As Word.Document, objWApp As Word.Application
Dim objM As Outlook.MailItem
Dim objI As Outlook.Inspector
Set objM = ActiveInspector.CurrentItem
Set objI = ActiveInspector
Set objDoc = objI.WordEditor
Set objWApp = objDoc.Application
objWApp.Templates.Item(1).AutoTextEntries.Item(1). Insert
objWApp.Selection.Range
Set objWApp = Nothing
Set objI = Nothing
Set objM = Nothing
Set objDoc = Nothing
EH:
If Err.Number 0 Then
Debug.Print Err.Description
Stop
Resume Next
End If
End Sub
--
Eric Legault (Outlook MVP, MCDBA, old school WOSA MCSD, B.A.)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
"Laie" wrote:
Hi
In an OL contact form I open a new mail with a button - fill in name and
adress - now i want to go to the end of the mail and fill in autotext at
the
cursor position.
I recorded a macro in word that is doin this.
i dont know how to start this macro fom the code of the form.
can anyone tell me how to do
call macro ?????