word addoleobject icon excel

M

marfi95

I am using the following command in my macro to embed an excel sheet in
my word document. I want it to display as an icon. using this does
display it as an icon, but it is using a generic folder icon and not
the excel icon.

Selection.InlineShapes.AddOLEObject
FileName:=FileString, _
LinkToFile:=LinkToFile, DisplayAsIcon:=true

I've tried using a Classtype of "Excel.Sheet", but it still does the
same thing.

Any ideas ?
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :
I am using the following command in my macro to embed an excel sheet
in my word document. I want it to display as an icon. using this
does display it as an icon, but it is using a generic folder icon and
not the excel icon.

Selection.InlineShapes.AddOLEObject
FileName:=FileString, _
LinkToFile:=LinkToFile, DisplayAsIcon:=true

I've tried using a Classtype of "Excel.Sheet", but it still does the
same thing.


Make sure you specify "Excel.Sheet.8"
If that isn't enough, you can force the icon:

Selection.InlineShapes.AddOLEObject ClassType:="Excel.Sheet.8",
FileName:= _

FileString, LinkToFile:=True, DisplayAsIcon:=True, IconFileName:= _

"C:\WINDOWS\Installer\{9011040C-6000-11D3-8CFE-0150048383C9}\xlicons.exe"
_

, IconIndex:=1, IconLabel:="WorkBook"


Of course, if you plan to distribute this, you will need extra code to make
sure that "C:\WINDOWS\Installer" is correct.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top