![]() |
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
|
|||
|
|||
![]()
In Outlook 2002, I need a macro to insert some standard text into a new mail
message then paste the contents of the clipboard in Courier New font (to maintain the format) below that text. With the following code I am able to do everything except format the clipboard contents using the Courier New font. Since I'm using Word as my editor, I created a macro in Word to search for the first phrase in the clipboard text, then select the text and change the font that way. That works, but my boss wants one macro in Outlook that will accomplish everything. Even if the whole body of the message (standard and clipboard text) is in Courier New font, that would be fine. We don't want all messages to use that font though. Does anyone have any ideas how I can do that? Public Sub ItineraryApproval() Dim MyItem As MailItem Dim sTempString As String On Error Resume Next Load TempFormForClipboard Set MyItem = Application.CreateItem(0) sTempString = "****NOTICE, PLEASE RESPOND ASAP****" & vbCrLf & vbCrLf & vbCrLf sTempString = sTempString & "Your name spelling must be same as picture I.D. Ticketing is required 24 hours after reservations are made. Please review the itinerary and return it signed." & vbCrLf & vbCrLf sTempString = sTempString & "SIGNATURE________________________________" & vbCrLf & vbCrLf sTempString = sTempString & vbCrLf & vbCrLf & vbCrLf & MyData.GetText(1) MyItem.Body = sTempString MyItem.Display Unload TempFormForClipboard End Sub -- Maureen |
#2
|
|||
|
|||
![]()
Am Fri, 17 Feb 2006 08:42:19 -0800 schrieb Maureen:
Maureen, if Word is the mail editor then the Inspector´s WordEditor property is a reference on the Word.Document object. You could add a reference on the Word library via Tools/References to your Outlook project and use that Document object like you´d do in a Word macro. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- In Outlook 2002, I need a macro to insert some standard text into a new message then paste the contents of the clipboard in Courier New font (to maintain the format) below that text. With the following code I am able to do everything except format the clipboard contents using the Courier New font. Since I'm using Word as my editor, I created a macro in Word to search for the first phrase in the clipboard text, then select the text and change the font that way. That works, but my boss wants one macro in Outlook that will accomplish everything. Even if the whole body of the message (standard and clipboard text) is in Courier New font, that would be fine. We don't want all messages to use that font though. Does anyone have any ideas how I can do that? Public Sub ItineraryApproval() Dim MyItem As MailItem Dim sTempString As String On Error Resume Next Load TempFormForClipboard Set MyItem = Application.CreateItem(0) sTempString = "****NOTICE, PLEASE RESPOND ASAP****" & vbCrLf & vbCrLf & vbCrLf sTempString = sTempString & "Your name spelling must be same as picture I.D. Ticketing is required 24 hours after reservations are made. Please review the itinerary and return it signed." & vbCrLf & vbCrLf sTempString = sTempString & "SIGNATURE________________________________" & vbCrLf & vbCrLf sTempString = sTempString & vbCrLf & vbCrLf & vbCrLf & MyData.GetText(1) MyItem.Body = sTempString MyItem.Display Unload TempFormForClipboard End Sub |
#3
|
|||
|
|||
![]()
Well, I'm lost. I think Inspector must be part of VB and since I'm learning
by seeing patterns in other code, I haven't run into that one yet. I found Tools/Reference in Outlook VB and checked the box for MS Word 10.0 Object Library, but I'm not sure what to do next. I'll keep reading and trying to make sense of it and will appreciate any additional help you can give. Thank you! -- Maureen "Michael Bauer" wrote: Am Fri, 17 Feb 2006 08:42:19 -0800 schrieb Maureen: Maureen, if Word is the mail editor then the Inspector´s WordEditor property is a reference on the Word.Document object. You could add a reference on the Word library via Tools/References to your Outlook project and use that Document object like you´d do in a Word macro. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- In Outlook 2002, I need a macro to insert some standard text into a new message then paste the contents of the clipboard in Courier New font (to maintain the format) below that text. With the following code I am able to do everything except format the clipboard contents using the Courier New font. Since I'm using Word as my editor, I created a macro in Word to search for the first phrase in the clipboard text, then select the text and change the font that way. That works, but my boss wants one macro in Outlook that will accomplish everything. Even if the whole body of the message (standard and clipboard text) is in Courier New font, that would be fine. We don't want all messages to use that font though. Does anyone have any ideas how I can do that? Public Sub ItineraryApproval() Dim MyItem As MailItem Dim sTempString As String On Error Resume Next Load TempFormForClipboard Set MyItem = Application.CreateItem(0) sTempString = "****NOTICE, PLEASE RESPOND ASAP****" & vbCrLf & vbCrLf & vbCrLf sTempString = sTempString & "Your name spelling must be same as picture I.D. Ticketing is required 24 hours after reservations are made. Please review the itinerary and return it signed." & vbCrLf & vbCrLf sTempString = sTempString & "SIGNATURE________________________________" & vbCrLf & vbCrLf sTempString = sTempString & vbCrLf & vbCrLf & vbCrLf & MyData.GetText(1) MyItem.Body = sTempString MyItem.Display Unload TempFormForClipboard End Sub |
#4
|
|||
|
|||
![]()
Am Mon, 20 Feb 2006 15:14:26 -0800 schrieb Maureen:
Maureen, you told us to have a script that runs fine in Word (but we don´t see or know that code). In Word you have a Document object which you´re using for sure. The same object you can use in Outlook if Word is the mail editor. Sample: Dim wd as Word.Document Set wd=Application.ActiveInspector.WordEditor Via the wd variable in Outlook you have now the same access to all the Document´s properties like you would have in Word. I think you can´t format the clipboard content itself. Instead you need to insert it into the Word Document first, then set the proper Range object and use the Range´s Font property. Sample for formatting all the Document: wd.Range.Font.Name = "courier new" -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Well, I'm lost. I think Inspector must be part of VB and since I'm learning by seeing patterns in other code, I haven't run into that one yet. I found Tools/Reference in Outlook VB and checked the box for MS Word 10.0 Object Library, but I'm not sure what to do next. I'll keep reading and trying to make sense of it and will appreciate any additional help you can give. Thank you! |
#5
|
|||
|
|||
![]()
Thank you very much! I think I can take it from here.
-- Maureen "Michael Bauer" wrote: Am Mon, 20 Feb 2006 15:14:26 -0800 schrieb Maureen: Maureen, you told us to have a script that runs fine in Word (but we don´t see or know that code). In Word you have a Document object which you´re using for sure. The same object you can use in Outlook if Word is the mail editor. Sample: Dim wd as Word.Document Set wd=Application.ActiveInspector.WordEditor Via the wd variable in Outlook you have now the same access to all the Document´s properties like you would have in Word. I think you can´t format the clipboard content itself. Instead you need to insert it into the Word Document first, then set the proper Range object and use the Range´s Font property. Sample for formatting all the Document: wd.Range.Font.Name = "courier new" -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.vbOffice.net -- Well, I'm lost. I think Inspector must be part of VB and since I'm learning by seeing patterns in other code, I haven't run into that one yet. I found Tools/Reference in Outlook VB and checked the box for MS Word 10.0 Object Library, but I'm not sure what to do next. I'll keep reading and trying to make sense of it and will appreciate any additional help you can give. Thank you! |
#6
|
|||
|
|||
![]()
This is surprisingly hard... why don't they have a "record macro" feature in
Outlook as they do in Word? No matter. One easy way to record macros and then use them in Outlook, avoiding a very costly macro programming learning curve, is to record them in Word, then set Outlook to edit e-mail using the Word editor. Now, all your Word macros (the ones saved in in Normal.dot) will be available when composing e-mail. To set Outlook 2003 to use Word as its editor, go to Tools, Options, then Mail Format tab, click the checkbox that says "Use Microsoft Word 2003 to Edit E-mail Messages", and Apply. To record your macro, you can open a new e-mail message which will bring up the Word editor, then use Tools, Macros, Record New Macro just like in Word. If you are a VB bithead, you can still edit the macro in VB and apply whatever customizations you need to the code. At least you're starting with some stock code, rather than from scratch. Now, "all your text are belong to Word." By doing this, I have a dropdown that allows me to easily switch to an all-text format, so that should be okay. I'm not sure of the security implications of using Word to compose e-mail messages; I suppose if I have a macro virus in Word, I might be able to spread it. Caveat emptor. Hope this helps. |
#7
|
|||
|
|||
![]()
I'm back with another question. I followed your suggestion, and it works
beautifully. The problem is that we had links in the Word form, so I had to change the Outlook format to HTML in addition to using Word as the editor. Now some of the email we receive daily that needs to be forwarded to our clients takes forever to open in Word. If I change the mailformat to RTF, forwarding those messages is no problem but the links don't work. Do you know of a way to make the links work in RTF? -- Maureen "Russ" wrote: This is surprisingly hard... why don't they have a "record macro" feature in Outlook as they do in Word? No matter. One easy way to record macros and then use them in Outlook, avoiding a very costly macro programming learning curve, is to record them in Word, then set Outlook to edit e-mail using the Word editor. Now, all your Word macros (the ones saved in in Normal.dot) will be available when composing e-mail. To set Outlook 2003 to use Word as its editor, go to Tools, Options, then Mail Format tab, click the checkbox that says "Use Microsoft Word 2003 to Edit E-mail Messages", and Apply. To record your macro, you can open a new e-mail message which will bring up the Word editor, then use Tools, Macros, Record New Macro just like in Word. If you are a VB bithead, you can still edit the macro in VB and apply whatever customizations you need to the code. At least you're starting with some stock code, rather than from scratch. Now, "all your text are belong to Word." By doing this, I have a dropdown that allows me to easily switch to an all-text format, so that should be okay. I'm not sure of the security implications of using Word to compose e-mail messages; I suppose if I have a macro virus in Word, I might be able to spread it. Caveat emptor. Hope this helps. |
#8
|
|||
|
|||
![]()
Please disregard my last question. I forgot that using Word as the email
editor is the problem, not HTML vs. RTF. -- Maureen "Russ" wrote: This is surprisingly hard... why don't they have a "record macro" feature in Outlook as they do in Word? No matter. One easy way to record macros and then use them in Outlook, avoiding a very costly macro programming learning curve, is to record them in Word, then set Outlook to edit e-mail using the Word editor. Now, all your Word macros (the ones saved in in Normal.dot) will be available when composing e-mail. To set Outlook 2003 to use Word as its editor, go to Tools, Options, then Mail Format tab, click the checkbox that says "Use Microsoft Word 2003 to Edit E-mail Messages", and Apply. To record your macro, you can open a new e-mail message which will bring up the Word editor, then use Tools, Macros, Record New Macro just like in Word. If you are a VB bithead, you can still edit the macro in VB and apply whatever customizations you need to the code. At least you're starting with some stock code, rather than from scratch. Now, "all your text are belong to Word." By doing this, I have a dropdown that allows me to easily switch to an all-text format, so that should be okay. I'm not sure of the security implications of using Word to compose e-mail messages; I suppose if I have a macro virus in Word, I might be able to spread it. Caveat emptor. Hope this helps. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
I have lost my calendar contents, where are they? | execman46 | Outlook - Calandaring | 1 | March 4th 06 09:32 AM |
clipboard | Joel Allen | Outlook and VBA | 1 | January 28th 06 06:04 PM |
Clipboard | Joel Allen | Outlook and VBA | 0 | January 26th 06 05:16 PM |
Clicking a mail copies it to the clipboard | Enrique Perez-Terron | Outlook Express | 3 | January 21st 06 08:51 PM |
how do I transfer file from Clipboard to an e-mail message | tommul | Outlook - General Queries | 1 | January 13th 06 10:22 PM |