LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Excel 2007: Error 400, Excel 2002: OK...

Hi, can somebody help me with this piece of code and tell me how I can
get it to work in both Excel 2002 and 2007?

Sub Auto_Open()
InsertPictureInRange "___URL_to_picture_on_the_net___", _
Range("G21:J29")
End Sub

Sub InsertPictureInRange(PictureFileName As String, TargetCells As
Range)
Dim p As Object, t As Double, l As Double, w As Double, h As Double
If TypeName(ActiveSheet) < "Worksheet" Then Exit Sub
Set p = ActiveSheet.Pictures.Insert(PictureFileName)
With TargetCells
t = .Top
l = .Left
w = .Offset(0, .Columns.Count).Left - .Left
h = .Offset(.Rows.Count, 0).Top - .Top
End With
With p
.Top = t
.Left = l
.Width = w
.Height = h
End With
Set p = Nothing
End Sub
 
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
Excel 2007 Hyperlink base removed when opening in Excel 2002 JoeBantering Links and Linking in Excel 0 August 10th 10 07:49 PM
personal.xls created in Excel 2007 and opened in Excel 2002 Jeannie Excel Discussion (Misc queries) 0 March 30th 10 09:03 PM
Excel 2007 crashes with large linked Excel 2002 workbooks Adam Hector Excel Discussion (Misc queries) 0 May 22nd 08 02:47 PM
Error when opening up file in Excel 2007, but not when opened withExcel 2002 [email protected] Excel Programming 0 February 1st 08 06:00 PM
Excel 2002: How is the Excel 2007 file format open in Excel 2002 ? Mr. Low Excel Discussion (Misc queries) 2 August 29th 07 11:46 PM


All times are GMT +1. The time now is 02:40 AM.

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"