LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Icons for attachments added via VBA


Hi,

I have a spreadsheet which I have protected to stop people tampering
with it. As a result in order to add attachments to it I have included
a button and some VBA code. Now this all works fine, except the
attachment doesn't pick up the icon of the associated application (eg:
a word doc, etc), any thoughts on this would be appreciated, below is
the code, thanks:

Private Sub cmdInsert_Click()
Dim strFilename As String
Dim varNumber As Variant
Dim strPosition As String

strFilename = Application.GetOpenFilename(, , "Add Attachment")
If strFilename < "False" Then
varNumber = InputBox("Enter attachment position number
(1 to 10)", "Add Attachement")

If varNumber = 1 And varNumber <= 10 Then
strPosition = "D" & varNumber + 5
Range(strPosition).Select

ActiveSheet.OLEObjects.Add(Filename:=strFilename,
Link:=False, _
DisplayAsIcon:=True, *IconFileName:=strFilename*,
IconIndex:=0, _
IconLabel:=strFilename.Select End
If
End IfEnd Sub


--
Nick-B
------------------------------------------------------------------------
Nick-B's Profile: http://www.excelforum.com/member.php...o&userid=37267
View this thread: http://www.excelforum.com/showthread...hreadid=569810

 
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
attachments - KIRK Setting up and Configuration of Excel 0 September 28th 07 08:01 PM
attachments Paul Excel Discussion (Misc queries) 3 September 5th 07 12:34 PM
E-mail Attachments STEVEB Excel Programming 1 August 23rd 05 02:27 PM
Attachments meyer99 Excel Worksheet Functions 1 June 22nd 05 10:11 AM
Attachments Gerry[_8_] Excel Programming 2 February 11th 05 06:26 PM


All times are GMT +1. The time now is 09:19 AM.

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"