Macro

  • Thread starter Thread starter 116
  • Start date Start date
1

116

My first attempt at a Macro, and I do not mess with VB enough. I am looking
for a sample to run 'alt+0216'.

Thanks
David
 
Alt+0216 makes no sense by itself. You need to provide a lot more context,
including the Outlook version and what you actually are trying to
accomplish.
 
I appoligize. Outlook 2003. I would like the macro to run the key sequence
'ALT + 0126' which is Ascii for a Diameter symbol.

David
 
You can return that character in VBA with this expression: Chr(216)

However, we still don't know what you want to do with it. Outlook macros
don't "run key sequences" unless you use a SendKeys kludge, which doesn't
always work.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
There are certain symbols I would like to start using rather than the text
(abbreviation). Such as the diameter, cents, symbols rather than spelling it
or abbreviating. So by creating a Macro and simply entering Chr(216) in the
VBA will take care of this?

David
 
No, it's nowhere near that simple. We still don't know *where* you want to
use these symbols or in which version of Outlook. If you can't provide that
information, it is not going to be possible to help you.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
Outlook 2003. The characters would be in the body of the e-mail. I use
Outlook to compose the e-mail, not Word. I am not sure what other info you
require.

David
 
Are these messages in HTML or plain text or RTF format?

FWIW, if you're not using Word as your email editor in Outlook 2003,
accomplishing this task for all three message formats would require a
third-party programming library. You may want to consider not using Outlook
VBA at all, but instead getting a generic keystroke recorder/playback tool.
I have no information on those, but any search engine can find them for you.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
I only use HTML in Outlook.

Sue Mosher said:
Are these messages in HTML or plain text or RTF format?

FWIW, if you're not using Word as your email editor in Outlook 2003,
accomplishing this task for all three message formats would require a
third-party programming library. You may want to consider not using Outlook
VBA at all, but instead getting a generic keystroke recorder/playback tool.
I have no information on those, but any search engine can find them for you.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
 
I don't have an Outlook 2003 system to test this on, but the code should
look something like this (adapted from
http://www.outlookcode.com/codedetail.aspx?id=1358):

Sub Insert216()
Call InsertSpecial("216")
End Sub

Sub InsertSpecial(strCharCode as String)
Dim msg As Outlook.MailItem
Dim insp As Outlook.Inspector
' need reference to Microsoft HTML Object Library
' at c:\windows\system32\mshtml.tlb
Dim hed As MSHTML.HTMLDocument
Dim rng As MSHTML.IHTMLTxtRange

Set insp = Application.ActiveInspector
If insp.CurrentItem.Class = olMail Then
Set msg = insp.CurrentItem
If insp.EditorType = olEditorHTML Then
Set hed = msg.GetInspector.HTMLEditor
Set rng = hed.Selection.createRange
rng.pasteHTML "&#" & strCharCode & ";"
End If
End If
Set insp = Nothing
Set rng = Nothing
Set hed = Nothing
Set msg = Nothing
End Sub

Note that I've written this as a macro that calls a reusable function. To
insert other special characters using their numbers, you would duplicate
that macro, each time using the appropriate number.

What is actually inserted into the HTML when you run the Insert216 macro is
Ø -- that's the generic HTML representation of that character, using
its decimal character code.
 
Back
Top