Hello guys,
I developed a project to search for images and insert then in the activecell. For the Excel 2010 it worked just fine, but for 2007 all the images go to the same place. Anyone can help me out?
Sub Imagem()
ActiveSheet.Unprotect Password:="Exemplo"
Dim Pict
Dim Imagem As Object
Dim ImgFileFormat As String
ImgFileFormat = "Image Files JPG (*.jpg),*.jpg, Image Files PNG (*.png),*.png , Image Files GIF (*.gif),*.gif , Image Files BMP(*.bmp),*.bmp"
Pict = Application.GetOpenFilename(ImgFileFormat)
If Pict = False Then End
Set Imagem = ActiveSheet.Pictures.Insert(Pict)
Imagem.Top = Imagem.TopLeftCell.Top
Imagem.Left = Imagem.TopLeftCell.Left
Imagem.ShapeRange.LockAspectRatio = msoTrue
Imagem.ShapeRange.Height = 76.5354330709
Imagem.ShapeRange.IncrementTop 30.6963779528
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowDeletingColumns:=True, AllowDeletingRows:=True, AllowSorting _
:=True, AllowFiltering:=True, AllowUsingPivotTables:=True, Password:="Exemplo"
End Sub
I developed a project to search for images and insert then in the activecell. For the Excel 2010 it worked just fine, but for 2007 all the images go to the same place. Anyone can help me out?
Sub Imagem()
ActiveSheet.Unprotect Password:="Exemplo"
Dim Pict
Dim Imagem As Object
Dim ImgFileFormat As String
ImgFileFormat = "Image Files JPG (*.jpg),*.jpg, Image Files PNG (*.png),*.png , Image Files GIF (*.gif),*.gif , Image Files BMP(*.bmp),*.bmp"
Pict = Application.GetOpenFilename(ImgFileFormat)
If Pict = False Then End
Set Imagem = ActiveSheet.Pictures.Insert(Pict)
Imagem.Top = Imagem.TopLeftCell.Top
Imagem.Left = Imagem.TopLeftCell.Left
Imagem.ShapeRange.LockAspectRatio = msoTrue
Imagem.ShapeRange.Height = 76.5354330709
Imagem.ShapeRange.IncrementTop 30.6963779528
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
True, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowDeletingColumns:=True, AllowDeletingRows:=True, AllowSorting _
:=True, AllowFiltering:=True, AllowUsingPivotTables:=True, Password:="Exemplo"
End Sub