Outlook has no idea what Selection refers to in that first line. My article
at
http://turtleflock-ol2007.spaces.live.com/blog/cns!C1013F1F9A99E3D8!579.entry
explains how to return a Word.Selection object from an Outlook message body.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54
"jjobin" <(E-Mail Removed)> wrote in message
news:5CAE563D-8A01-4D91-A1EC-(E-Mail Removed)...
>I have created the following macro in Word 2007. It is designed to take a
> number and convert it to a barcode. (note that you have the barcode font
> installed for the barcode to appear). If you select a number (highlight)
> then
> run the macro, it will produce the barcode directly under the number.
>
> It works perfect in Word 2007 but I'm wanting it to function in Outlook
> 2007. The macro does not even appear in the Developer-Macro-Macro Name
> section.
> I can cut and paste the code into Outlook 2007, VBA, but when I run it I
> get
> an error on the first line of code.
> Sub Convert2BarCode()
> '
> ' Convert2BarCode Macro
> '
> '
> Selection.Copy
> Selection.Copy
> Selection.EndKey Unit:=wdLine
> Selection.TypeParagraph
> Selection.PasteAndFormat (wdPasteDefault)
> Selection.MoveUp Unit:=wdLine, Count:=1
> Selection.TypeText Text:="*"
> Selection.EndKey Unit:=wdLine
> Selection.TypeText Text:="*"
> Selection.MoveLeft Unit:=wdCharacter, Count:=17, Extend:=wdExtend
> Selection.Font.Name = "SKANDATA C39"
> Selection.Font.Size = 24
> End Sub
>