Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Hlp - Display only file name when Insert Object As Icon

Hi,

I'm wondering how I would insert *only* the file name (not the path) when
using the following:

ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

I tried adding:
IconLabel:=Mid(strFile, InStrRev(strFile, "\") + 1)

As helped in another macro, but it didn't work.
Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Hlp - Display only file name when Insert Object As Icon

It looks like all you have to do is replace the C:\ with your filename.
Actually, any text can be used (there doesn't seem to be any linkage between
what is placed in the File Name field and what part of the directory tree
displays if you click the Browse button)...

ExecuteExcel4Macro "INSERT.OBJECT?(,""Some text"",False,True,)"

I just want to point out that there is a VB equivalent for this command...

Application.Dialogs(xlDialogInsertObject).Show , "Some Text", , True

According to the help files (Built-In Dialog Box Argument Lists), these are
the arguments you can specify for it...

object_class, file_name, link_logical, display_icon_logical, icon_file,
icon_number, icon_label

--
Rick (MVP - Excel)


"Joyce" wrote in message
...
Hi,

I'm wondering how I would insert *only* the file name (not the path) when
using the following:

ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

I tried adding:
IconLabel:=Mid(strFile, InStrRev(strFile, "\") + 1)

As helped in another macro, but it didn't work.
Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Hlp - Display only file name when Insert Object As Icon

Hi Rick,

Thanks for your response. I've tried modifying to this, but can't figure
out how to include the Mid function to extract only the file name (and not
the path) to be displayed as the icon label.

Dim sFile As Dialog
Set sFile = Application.Dialogs(xlDialogInsertObject).Show , iconlabel =
Mid(sFile, InStrRev(sFile, "\") + 1), , True

I get a syntax error.

"Rick Rothstein" wrote:

It looks like all you have to do is replace the C:\ with your filename.
Actually, any text can be used (there doesn't seem to be any linkage between
what is placed in the File Name field and what part of the directory tree
displays if you click the Browse button)...

ExecuteExcel4Macro "INSERT.OBJECT?(,""Some text"",False,True,)"

I just want to point out that there is a VB equivalent for this command...

Application.Dialogs(xlDialogInsertObject).Show , "Some Text", , True

According to the help files (Built-In Dialog Box Argument Lists), these are
the arguments you can specify for it...

object_class, file_name, link_logical, display_icon_logical, icon_file,
icon_number, icon_label

--
Rick (MVP - Excel)


"Joyce" wrote in message
...
Hi,

I'm wondering how I would insert *only* the file name (not the path) when
using the following:

ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

I tried adding:
IconLabel:=Mid(strFile, InStrRev(strFile, "\") + 1)

As helped in another macro, but it didn't work.
Thanks.



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
Insert image or icon to rollover and display larger version Rocky Excel Discussion (Misc queries) 2 October 30th 09 08:20 PM
Icon Type and Name when Insert File As Icon Joyce Excel Programming 2 October 2nd 09 05:25 PM
Display only file name in embedded icon Joyce Excel Programming 0 September 30th 09 03:46 PM
Icon for inserted file object doesn't collapse away when closeoutline group Paul Excel Discussion (Misc queries) 2 April 1st 08 10:46 PM
Toggling Display as Icon for OLE Object [email protected] Excel Programming 0 July 13th 05 09:13 PM


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