PC Review


Reply
Thread Tools Rate Thread

Can't run macro Outlook 2007 that was created in Word 2007

 
 
jjobin
Guest
Posts: n/a
 
      22nd Jan 2010
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

 
Reply With Quote
 
 
 
 
Sue Mosher [MVP]
Guest
Posts: n/a
 
      22nd Jan 2010
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
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
created encryped.docx in Word 2007, edited in 2010, now cannot open in 2007 techfrogger Microsoft Word Document Management 1 7th Apr 2010 05:30 PM
Signature macro with Word/Outlook 2007... Fuel451 Microsoft Word Document Management 1 15th Oct 2009 06:07 PM
Mergeing excel 2007 data with a label created in word 2007 Bob A Microsoft Word Document Management 1 12th Aug 2008 10:45 PM
Macro works in Word 2007, but not in Outlook 2007 =?Utf-8?B?TGVzRw==?= Microsoft Outlook VBA Programming 13 10th Mar 2007 11:30 PM
how do i open word docs created in 2007 beta with word 2007? =?Utf-8?B?dnRjdzM0?= Microsoft Word Document Management 0 22nd Feb 2007 11:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:19 AM.