Works in 2003 but not in 2007

dcoledc

Active Member
Joined
May 6, 2010
Messages
403
I recorded this macro in Excel 2003 and it works fine:

Code:
Sub Vertical()
    ActiveSheet.Unprotect
    ActiveSheet.Shapes.AddLine(597.75, 57, 597.75, 600#).Select
    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 = 10
    Selection.ShapeRange.Line.BackColor.RGB = RGB(255, 255, 255)
    Selection.ShapeRange.Line.BeginArrowheadLength = msoArrowheadLengthMedium
    Selection.ShapeRange.Line.BeginArrowheadWidth = msoArrowheadWidthMedium
    Selection.ShapeRange.Line.BeginArrowheadStyle = msoArrowheadNone
    Selection.ShapeRange.Line.EndArrowheadLength = msoArrowheadLengthMedium
    Selection.ShapeRange.Line.EndArrowheadWidth = msoArrowheadWidthMedium
    Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadNone
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Height = 580
    Selection.ShapeRange.Width = 0#
    Selection.ShapeRange.Rotation = 0#
    Selection.Locked = False
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
    
End Sub

Two question.
1. Does anyone have any idea why this code would not work in Excel 2007? I don't have excel 2007 so I can't try recording it on there and comparing. I found out it doesn't work from a user.

2. Is there a better way to write this code? Basically, I want to hit the macro and a line appears in a specific location on the sheet for the user.

Thanks, Dan
 
Sorry, yes I know what a png is. My suggestion was that you put your image where it should be and rather than copy it all over the place just have it hidden until such time as it is called

Code:
ActiveSheet.Shapes("Picture 1").Visible = False

Code:
ActiveSheet.Shapes("Picture 1").Visible = True

I know IE has issues with png images but I think they work well enough with Office
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
The problem with that is that I want the image(.png file) to appear multiple times, each time they hit the button. I suppose I could do what you are suggesting and include a copy paste code in there.

Do you think this will get rid of the words that are there when a 2007 user opens the file. I am near certain, the words that appear on the screen have to do with the old code and not the .png file b/c the user can click on the words and alter them. They would not be able to do this with the .png file. Having said that if you think your suggestion will correct my problem I will give it a go.

Thanks, Dan

P.S. the words appear before the new macro is even run. They are there as soon as a 2007 user opens the file.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,687
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top