M
marc747
Hi, I have a macro in excel that by clicking on it opens a folder to
insert a picture everything works great in excel 2000 but I have
people that are using excel 2003 or 2007 and a few that use excel for
Mac, on some it give a problem and on some it does not work at all.
Is there anything that I can insert in the macro to make it more
compatible with all different versions of excel.
Following is my Macro.
******************************************************************************
Sub InsertPicture()
Dim myPicture As String, MyObj As Object
Range("A14").Select
myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp;
*.tif", _
, "Select Picture to Import")
If myPicture = "False" Then Exit Sub
ActiveSheet.Unprotect Password:="test"
Application.ScreenUpdating = False
Set MyObj = ActiveSheet.Pictures.Insert(myPicture)
With MyObj
With .ShapeRange
..LockAspectRatio = False
.Height = 170
.Width = 200
.Left = .Left + 2
.Top = .Top + 12
End With
.Placement = xlMoveAndSize
End With
Set MyObj = Nothing
Application.ScreenUpdating = True
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=
_
True, Password:="test"
End Sub
**********************************************************************************
insert a picture everything works great in excel 2000 but I have
people that are using excel 2003 or 2007 and a few that use excel for
Mac, on some it give a problem and on some it does not work at all.
Is there anything that I can insert in the macro to make it more
compatible with all different versions of excel.
Following is my Macro.
******************************************************************************
Sub InsertPicture()
Dim myPicture As String, MyObj As Object
Range("A14").Select
myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp;
*.tif", _
, "Select Picture to Import")
If myPicture = "False" Then Exit Sub
ActiveSheet.Unprotect Password:="test"
Application.ScreenUpdating = False
Set MyObj = ActiveSheet.Pictures.Insert(myPicture)
With MyObj
With .ShapeRange
..LockAspectRatio = False
.Height = 170
.Width = 200
.Left = .Left + 2
.Top = .Top + 12
End With
.Placement = xlMoveAndSize
End With
Set MyObj = Nothing
Application.ScreenUpdating = True
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=
_
True, Password:="test"
End Sub
**********************************************************************************