Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default OLEObjects collections for embedded files

I am having the worse time trying to manipulate the OLEObjects
collection. I am able to add objects to my Excel 2002 workbook, but I
have difficulty when trying to reference the objects I added by NAME.
Here is the code I use to add the imbedded file objects. How would I
then reference these objects by the NAME that I gave them instead of
the INDEX number. Does the INDEX number change as objects are deleted
from a Worksheet? Thanks.

filesel = Application.GetOpenFilename _
(FileFilter:="All files (*.*), *.*", _
Title:="Select Files to Attach", MultiSelect:=True)
If Not IsArray(filesel) Then Exit Sub

ws.Activate
OLEnum = ActiveSheet.OLEObjects.Count
For i = 1 To UBound(filesel)
thisFullName = filesel(i)
thisFile = Dir(thisFullName)
o = o + 1
ActiveSheet.OLEObjects.Add(Filename:=thisFullName, _
Link:=False, DisplayAsIcon:=True, _
IconFileName:="packager.exe", _
IconIndex:=0, IconLabel:=thisFile).Name = thisFile
OLEnum = OLEnum + 1
ActiveSheet.OLEObjects(OLEnum).Name = thisFile
With ActiveSheet.OLEObjects(OLEnum)
.top = rg.Cells(c).top
.Left = rg.Cells(c).Left
.Width = rg.Cells(c).Width
.Height = rg.Cells(c).Height
End With
c = c + 1
With Me.boxAttachments
.AddItem OLEnum
.List(boxAttachments.ListCount - 1, 1) = thisFile
End With
Next i

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
Embedded files Lindae Excel Discussion (Misc queries) 1 May 18th 09 12:08 PM
embedded wav files ARGT Excel Discussion (Misc queries) 4 July 21st 08 10:53 AM
Running an add-in recursively on embedded files akullen[_2_] Excel Programming 1 June 17th 06 10:26 PM
Embedded files in Excel jminickene Excel Programming 0 October 8th 04 02:41 AM
embedded files nath Excel Programming 0 September 17th 03 02:17 PM


All times are GMT +1. The time now is 11:00 PM.

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

About Us

"It's about Microsoft Excel"