Hello all. First off, I am a novice to VBA programming, but I do have a small background in c++, perl, and some other odd scripting languages.
I am running:
Windows XP sp2
Office 2007
Here is the problem that I am faced with. I have a macro that is adding a small rectangular textbox with some variables that are entered at the beginning of the macro ontop of 4 charts. It works in 2003, but when I run the macro in 2007 it doesn't add the small textbox at all. Any suggestions:
Code:
Public Sub chartstitle()
'
' Insert text box between 4 graphs with type of data, part number and serial number
'
Dim xplace, yplace As String
Dim charttitlesize As Single
charttitlesize = Fontsize + 4
ActiveWindow.Visible = True ' False
ActiveSheet.Shapes.AddLabel(msoTextOrientationHorizontal, 470#, 300#, 0#, 0#).Select ' Positions text box in center of four quad charts
Selection.ShapeRange(1).TextFrame.AutoSize = msoTrue
Selection.Characters.Text = datasheet & " Data" & Chr(10) & PartRef & Chr(10) & "s/n: " & SerialRef ' Creates character string with returns of three text attributes
Selection.HorizontalAlignment = xlCenter ' Sets text to be center aligned
With Selection.Font ' Sets text box font attributes
.Name = Fontstr
.FontStyle = "Bold"
.Size = charttitlesize
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Selection.ShapeRange.Fill.Visible = msoTrue ' Sets box attributes including color, light yellow
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(201, 195, 127)
Selection.ShapeRange.Fill.Transparency = 0#
Selection.ShapeRange.Line.Weight = 0.75
Selection.ShapeRange.Line.DashStyle = msoLineSolid
Selection.ShapeRange.Line.style = msoLineSingle
Selection.ShapeRange.Line.Transparency = 0#
Selection.ShapeRange.Line.Visible = msoTrue
Selection.ShapeRange.Line.ForeColor.RGB = RGB(201, 195, 127)
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
ActiveSheet.Range("A1:V51").Select 'Ends selecting all graph range ready for user to copy and paste without selecting again
End Sub
Bookmarks