Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Code to Insert File as Icon & Open Browse Dialog Box

Hi,

I am wondering if it's possible to get users of a file to the Browse dialog
box when inserting an object as an icon.

This gets me almost there...
ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Code to Insert File as Icon & Open Browse Dialog Box

strFile = Application.GetOpenFilename

If this post helps click Yes
---------------
Jacob Skaria


"Joyce" wrote:

Hi,

I am wondering if it's possible to get users of a file to the Browse dialog
box when inserting an object as an icon.

This gets me almost there...
ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Code to Insert File as Icon & Open Browse Dialog Box

'for the second part of the question

strFile = Application.GetOpenFilename
ActiveSheet.OLEObjects.Add Filename:=strFile, Link:=False, _
DisplayAsIcon:=True, IconFileName:=strIconFile, IconIndex:=0, _
IconLabel:=strFile

'Record a macro..and edit to suit...

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

strFile = Application.GetOpenFilename

If this post helps click Yes
---------------
Jacob Skaria


"Joyce" wrote:

Hi,

I am wondering if it's possible to get users of a file to the Browse dialog
box when inserting an object as an icon.

This gets me almost there...
ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

Thank you.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Code to Insert File as Icon & Open Browse Dialog Box

Hello Jacob and thank you for your response.

It works beautifully. I'm wondering if there's anything I can add to do
either of the following:

1. Display only the file name and not the complete path.
2. Display the icon image of the software the file was created in (Adobe,
Word, Excel)

Thanks very much.

"Jacob Skaria" wrote:

'for the second part of the question

strFile = Application.GetOpenFilename
ActiveSheet.OLEObjects.Add Filename:=strFile, Link:=False, _
DisplayAsIcon:=True, IconFileName:=strIconFile, IconIndex:=0, _
IconLabel:=strFile

'Record a macro..and edit to suit...

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

strFile = Application.GetOpenFilename

If this post helps click Yes
---------------
Jacob Skaria


"Joyce" wrote:

Hi,

I am wondering if it's possible to get users of a file to the Browse dialog
box when inserting an object as an icon.

This gets me almost there...
ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

Thank you.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Code to Insert File as Icon & Open Browse Dialog Box

Modified to display just the file name...For the icon try recording a macro
and copy paste the iconfilename from the recorded macro to the below code...

strFile = Application.GetOpenFilename
ActiveSheet.OLEObjects.Add Filename:=strFile, Link:=False, _
DisplayAsIcon:=True, IconFileName:=strIconFile, IconIndex:=0, _
IconLabel:=Mid(strFile, InStrRev(strFile, "\") + 1)

If this post helps click Yes
---------------
Jacob Skaria


"Joyce" wrote:

Hello Jacob and thank you for your response.

It works beautifully. I'm wondering if there's anything I can add to do
either of the following:

1. Display only the file name and not the complete path.
2. Display the icon image of the software the file was created in (Adobe,
Word, Excel)

Thanks very much.

"Jacob Skaria" wrote:

'for the second part of the question

strFile = Application.GetOpenFilename
ActiveSheet.OLEObjects.Add Filename:=strFile, Link:=False, _
DisplayAsIcon:=True, IconFileName:=strIconFile, IconIndex:=0, _
IconLabel:=strFile

'Record a macro..and edit to suit...

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

strFile = Application.GetOpenFilename

If this post helps click Yes
---------------
Jacob Skaria


"Joyce" wrote:

Hi,

I am wondering if it's possible to get users of a file to the Browse dialog
box when inserting an object as an icon.

This gets me almost there...
ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

Thank you.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Code to Insert File as Icon & Open Browse Dialog Box

Thanks Jacob. That worked beautifully.

There are two things I'm wondering now.

1. What if the file is pdf or another type of file - is there a select case
I could use?
2. What if the user's computer doesn't use the exact path to the icon file
as mine?

Thanks again for your help!


"Jacob Skaria" wrote:

Modified to display just the file name...For the icon try recording a macro
and copy paste the iconfilename from the recorded macro to the below code...

strFile = Application.GetOpenFilename
ActiveSheet.OLEObjects.Add Filename:=strFile, Link:=False, _
DisplayAsIcon:=True, IconFileName:=strIconFile, IconIndex:=0, _
IconLabel:=Mid(strFile, InStrRev(strFile, "\") + 1)

If this post helps click Yes
---------------
Jacob Skaria


"Joyce" wrote:

Hello Jacob and thank you for your response.

It works beautifully. I'm wondering if there's anything I can add to do
either of the following:

1. Display only the file name and not the complete path.
2. Display the icon image of the software the file was created in (Adobe,
Word, Excel)

Thanks very much.

"Jacob Skaria" wrote:

'for the second part of the question

strFile = Application.GetOpenFilename
ActiveSheet.OLEObjects.Add Filename:=strFile, Link:=False, _
DisplayAsIcon:=True, IconFileName:=strIconFile, IconIndex:=0, _
IconLabel:=strFile

'Record a macro..and edit to suit...

If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

strFile = Application.GetOpenFilename

If this post helps click Yes
---------------
Jacob Skaria


"Joyce" wrote:

Hi,

I am wondering if it's possible to get users of a file to the Browse dialog
box when inserting an object as an icon.

This gets me almost there...
ExecuteExcel4Macro "INSERT.OBJECT?(,""C:\"",False,True,)"

Thank you.

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
Icon Type and Name when Insert File As Icon Joyce Excel Programming 2 October 2nd 09 05:25 PM
Code for bring up the file-open dialog box Ben Excel Programming 3 February 10th 06 03:21 AM
FIle Open/Browse on Macintosh TooTall Excel Programming 1 October 31st 05 06:23 PM
File Browse Function (Open dialog box for choosing file) b-123 Excel Programming 1 August 25th 05 10:06 PM
using Windows API Open Dialog/Browse in VBA - center form in scree Philip Excel Programming 1 April 19th 05 02:15 PM


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