Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Macro 2003 vs 2007

This macros below allowed me to insert a picture that I choose into Cell G1
at the correct heigth and with in 2003. Now in 2007 it does not put it into
the cell I want so the placement on the Excel sheet is wrong and I have to
drag it to the desired cell. Any Ideas?

Sub InsertPicture()
Dim myPicture As String, MyObj As Object

Range("g1").Select

myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", _
, "Select Picture to Import")

If myPicture = "False" Then Exit Sub

Set MyObj = ActiveSheet.Pictures.Insert(myPicture)

With MyObj
With .ShapeRange
.LockAspectRatio = msoFalse
.Height = 198
.Width = 280
End With
.Placement = x1MoveAndSize

End With

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9,101
Default Macro 2003 vs 2007

Pictures don't go into cells but sits ontop of th eworksheet. You can make a
picture look as if it is in a cell but it is not really in the cell.try these
changes

Sub InsertPicture()
Dim myPicture As String, MyObj As Object


myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", _
, "Select Picture to Import")

If myPicture = "False" Then Exit Sub

Set MyObj = ActiveSheet.Pictures.Insert(myPicture)

With MyObj
With .ShapeRange
.LockAspectRatio = msoFalse
.Left = Range("G1").Left
.Top = Range("G1").Top
.Height = Range("G1").Height
.Width = Range("G1").Width
End With
End With

End Sub


"Ron" wrote:

This macros below allowed me to insert a picture that I choose into Cell G1
at the correct heigth and with in 2003. Now in 2007 it does not put it into
the cell I want so the placement on the Excel sheet is wrong and I have to
drag it to the desired cell. Any Ideas?

Sub InsertPicture()
Dim myPicture As String, MyObj As Object

Range("g1").Select

myPicture = Application.GetOpenFilename _
("Pictures (*.gif; *.jpg; *.bmp; *.tif),*.gif; *.jpg; *.bmp; *.tif", _
, "Select Picture to Import")

If myPicture = "False" Then Exit Sub

Set MyObj = ActiveSheet.Pictures.Insert(myPicture)

With MyObj
With .ShapeRange
.LockAspectRatio = msoFalse
.Height = 198
.Width = 280
End With
.Placement = x1MoveAndSize

End With

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2003 macro generates compiler error on 2007 KenInPortland Excel Worksheet Functions 2 September 2nd 08 09:45 PM
Macro for Pivot in MS Excel 2003 vs 2007 MichaelR Excel Discussion (Misc queries) 1 July 25th 08 01:02 AM
Excel 2007 Macro Help (Excel 2003 not working in 2007) Pman Excel Discussion (Misc queries) 4 May 29th 08 06:29 PM
2003 - 2007 custom macro and custom button restore. Scott Sornberger Excel Discussion (Misc queries) 11 May 23rd 08 02:41 PM
Place an IF Statement into a Macro 2007 and 2003 Lisa Excel Discussion (Misc queries) 5 January 4th 08 05:30 PM


All times are GMT +1. The time now is 04:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"