Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default OLEobject on the sheet

Dear Experts,

I have an image control on the worksheet but I couldn't
find right property name to change the path of the image
file in the macro. Actualy I used the macro recorder to
generate the code creating the image box on the sheet and
run the macro the create it automatically. The code is
like this

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Image .1",
Link:=False, DisplayAsIcon:=False, Left:=240, _
Top:=32.25, Width:=345.75, Height:= 182.25).Select

What can I do next to insert the image filename for this
control?

Thanks for your help
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default OLEobject on the sheet

This worked ok for me:

Option Explicit
Sub testme01()

Dim OLEObj As OLEObject
Dim myRng As Range

Set myRng = Worksheets("sheet1").Range("c9:d16")

With myRng
Set OLEObj = .Parent.OLEObjects.Add(ClassType:="Forms.Image.1", _
Link:=False, DisplayAsIcon:=False, Left:=.Left, _
Top:=.Top, Width:=.Width, Height:=.Height)
End With

OLEObj.Object.Picture = LoadPicture(Filename:="C:\pict.jpg")

End Sub


Ryan wrote:

Dear Experts,

I have an image control on the worksheet but I couldn't
find right property name to change the path of the image
file in the macro. Actualy I used the macro recorder to
generate the code creating the image box on the sheet and
run the macro the create it automatically. The code is
like this

ActiveSheet.OLEObjects.Add(ClassType:="Forms.Image .1",
Link:=False, DisplayAsIcon:=False, Left:=240, _
Top:=32.25, Width:=345.75, Height:= 182.25).Select

What can I do next to insert the image filename for this
control?

Thanks for your help
Ryan


--

Dave Peterson

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
excel sheet bootom half sheet goes behind top part of sheet rob Excel Worksheet Functions 2 January 17th 09 01:28 AM
Change and refresh OLEObject showing Excel chart on Access form. Chrisso Charts and Charting in Excel 0 December 23rd 08 04:57 PM
Duplicate sheet, autonumber sheet, record data on another sheet des-sa[_2_] Excel Worksheet Functions 0 May 8th 08 06:56 PM
How do I select price from sheet.b where sheet.a part no = sheet.b Sonny Excel Worksheet Functions 4 April 4th 06 05:08 PM
Using a variable to represent a Checkbox Name(OLEObject) Mike Cooper Excel Programming 1 July 16th 03 09:40 PM


All times are GMT +1. The time now is 05:30 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"