Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newb Q. Encountering Errors running Macro in Word. 1

Status
Not open for further replies.

Reefslayer

IS-IT--Management
Feb 5, 2003
17
GB
Hello All.
I'm from a networking background so I'm entirely out of my depth encountering errors in the code below.
I assume this macro can be used to enforce fonts/styles etc.
When I run it within the doc I get Compile Error: Method or Data member not found. This occurs at the .UnderlineColor = line. I've checked on the net for code references and the syntax appears to be correct. could anyone provide any pointers for me in terms of:-
What exactly is the code trying to do?
What is the most likely cause/resolution to my error?
Is there likely to be an office version dependancy involved. (i'm running Office 97 and suspect this was authored on a later version.
I've downloaded and installed VB6 Runtime but this hasn't made any difference.
Any help appreciated.
Thanks
Paul.

Sub size3pt7()
'
' size3pt7 Macro
' Macro recorded þ25/05/2002 by richie
'
Selection.InlineShapes(1).Fill.Visible = msoFalse
Selection.InlineShapes(1).Fill.Transparency = 0#
Selection.InlineShapes(1).Line.Weight = 0.75
Selection.InlineShapes(1).Line.Transparency = 0#
Selection.InlineShapes(1).Line.Visible = msoFalse
Selection.InlineShapes(1).LockAspectRatio = msoTrue
Selection.InlineShapes(1).Height = 10.5
Selection.InlineShapes(1).Width = 9.4
Selection.InlineShapes(1).PictureFormat.Brightness = 0.5
Selection.InlineShapes(1).PictureFormat.Contrast = 0.5
Selection.InlineShapes(1).PictureFormat.ColorType = msoPictureAutomatic
Selection.InlineShapes(1).PictureFormat.CropLeft = 0#
Selection.InlineShapes(1).PictureFormat.CropRight = 0#
Selection.InlineShapes(1).PictureFormat.CropTop = 0#
Selection.InlineShapes(1).PictureFormat.CropBottom = 0#
With Selection.Font
.Name = "Garamond"
.Size = 11
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = -2
.Kerning = 0
.Animation = wdAnimationNone
.SizeBi = 11
.NameBi = "Times New Roman"
.BoldBi = False
.ItalicBi = False
End With
End Sub
 
Hi Reefslayer,

You are correct. UnderlineColor is not available in Word 97 so I would just remove the line. You will also have similar problems with the bidirectional properties (.SizeBi, .BoldBi, etc) and maybe others (I haven't checked them all).

The code is setting a particular set of attributes on the selected text and shape in the document; it won't enforce anything - it just provides a way of doing a lot of formatting all at once. I don't know what you want so can't say whether it will suit.

Enjoy,
Tony
 
Many thanks Tony.
Looks as though I was in the right ball park.
Just wondering wether to upgrade to Office 2000 or XP. suppose Xp makes the most sense if I'm to bother at all but I'll probably introduce new problems knowing my luck!
Thanks for your Help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top