![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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 ????? |
Ads |
#2
|
|||
|
|||
![]()
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 ????? |
#3
|
|||
|
|||
![]()
Thanks for the tip with Microsoft Word Object Model
there are alot of things to know!! as you see in the other posting with the code in OL form I use a button to send the same mail ( with button 10) to different contacts after telefon. so in any case the wordemail is opened. if I could find out how to start the macro in word I can do the same with other buttons with other text with one click the mail will be ready for sending. With the klick on the button I also write in the contacts body what mail has been sent to the kontakt and the date. for this reason it would be easier to start the makro in word as email editor. clicking the button 1-15 the information 1-15 is writen in the body and the mail is ready for sendig. so would you be so kind and help me to start the makro in word as discribed in the other posting and to tel me where to put what code in my OL button code. hope you can help me. Thanks "Eric Legault [MVP - Outlook]" schrieb im Newsbeitrag ... 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 ????? |
#4
|
|||
|
|||
![]()
t's far better to store the code in Outlook, and then you don't have to worry
about storing the macros in the Normal.dot or expecting it in the Word document itself. Just copy the macro I wrote to your ThisOutlookSession module in the Outlook VBA Editor (ALT+F11) and ensure that you select the Microsoft Word Object Model in the References dialog. Then enter customize mode for the toolbar in an e-mail window, select Macros from the Categories list in the Commands tab, and drag your macro in the Commands list to the toolbar. Click that button whenever you need to auto-insert text in an e-mail when you use Word as the 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 for the tip with Microsoft Word Object Model there are alot of things to know!! as you see in the other posting with the code in OL form I use a button to send the same mail ( with button 10) to different contacts after telefon. so in any case the wordemail is opened. if I could find out how to start the macro in word I can do the same with other buttons with other text with one click the mail will be ready for sending. With the klick on the button I also write in the contacts body what mail has been sent to the kontakt and the date. for this reason it would be easier to start the makro in word as email editor. clicking the button 1-15 the information 1-15 is writen in the body and the mail is ready for sendig. so would you be so kind and help me to start the makro in word as discribed in the other posting and to tel me where to put what code in my OL button code. hope you can help me. Thanks "Eric Legault [MVP - Outlook]" schrieb im Newsbeitrag ... 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 ????? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
no automatic fill of from-field | erik | Outlook - General Queries | 4 | February 22nd 06 01:42 PM |
OL2003 - can you auto-fill a singel new contact form with online form data | TimR | Outlook - Using Contacts | 1 | February 15th 06 02:43 PM |
How do I get my XP Pro Outlook to auto fill email addresses? | Rick | Outlook - General Queries | 1 | January 15th 06 04:36 PM |
zip code | tn10 | Outlook - Using Contacts | 0 | January 13th 06 05:22 PM |
zip code | tn10 | Outlook - Using Contacts | 0 | January 13th 06 05:21 PM |