V
vbaexperimenter
This is a macro that one of our ex-employees created in excel 2002. When I
try to run it in 2007 I get the error Variable not defined on the line 2nd
line strWP. I can't find anything online to help me to replace that command.
I found that it is a Varient string, but nothing else. Can someone give me
some ideas?
Sub Work_Paper()
'
strWP = InputBox("Enter workpaper reference:", "Workpaper")
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 100,
100, 0# _
, 0#).Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 12
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.SchemeColor = 12
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.TextFrame.MarginLeft = 0.75
Selection.ShapeRange.TextFrame.MarginRight = 0.75
Selection.ShapeRange.TextFrame.MarginTop = 0#
Selection.ShapeRange.TextFrame.MarginBottom = 0#
Selection.ShapeRange(1).TextFrame.AutoSize = msoTrue
Selection.Characters.Text = strWP
Selection.ShapeRange.Height = 10.2
Selection.Cut
ActiveSheet.Paste
End Sub
try to run it in 2007 I get the error Variable not defined on the line 2nd
line strWP. I can't find anything online to help me to replace that command.
I found that it is a Varient string, but nothing else. Can someone give me
some ideas?
Sub Work_Paper()
'
strWP = InputBox("Enter workpaper reference:", "Workpaper")
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 100,
100, 0# _
, 0#).Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Selection.ShapeRange.Fill.Visible = msoTrue
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 12
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.SchemeColor = 12
Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
Selection.ShapeRange.TextFrame.MarginLeft = 0.75
Selection.ShapeRange.TextFrame.MarginRight = 0.75
Selection.ShapeRange.TextFrame.MarginTop = 0#
Selection.ShapeRange.TextFrame.MarginBottom = 0#
Selection.ShapeRange(1).TextFrame.AutoSize = msoTrue
Selection.Characters.Text = strWP
Selection.ShapeRange.Height = 10.2
Selection.Cut
ActiveSheet.Paste
End Sub