Thread
:
Icons for attachments added via VBA
View Single Post
#
2
Posted to microsoft.public.excel.programming
Gary Brown
external usenet poster
Posts: 178
Icons for attachments added via VBA
FYI,
Putting on the macro recorder I pulled up...
-for a Word Document:
IconFileName:=
"C:\WINNT\Installer\{00020409-78E1-11D2-B60F-006097C998E7}\wordicon.exe"
-for a PDF:
IconFileName:=
"C:\WINNT\Installer\{AC76BA86-1033-0000-7760-000000000002}\PDFFile.ico"
-Excel file:
IconFileName:=
"C:\WINNT\Installer\{00020409-78E1-11D2-B60F-006097C998E7}\xlicons.exe"
Seems you need to determine the type of file being attached, find the
appropriate program and insert that value into the IconFileName value.
--
HTH,
Gary Brown
If this post was helpful to you, please select ''YES'' at the bottom of the
post.
"Nick-B" wrote:
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
Reply With Quote
Gary Brown
View Public Profile
Find all posts by Gary Brown