Hi guys i have this issue. I'm uploading a .msg file but i can't seem to go through with the DisplayAsIcon option and i also want to put the Date at the end of the file's name,to somehow track the uploaded files and maybe sort them by date. At the time of the upload moment i see the filesname with the date at the end of the name but after i save the file it overwrites the objects icon the i end up with an envelop icon and the uploaded files name. Here's my code:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Select Case ActiveCell.Address
Case "$I$29": Run "Email"
End Select
end sub
Public Sub Email()
Dim vFile As Variant
Dim objI As Object
Dim objJ As Object
Dim rngI As Range
Application.ScreenUpdating = False
vFile = Application.GetOpenFilename("E-mail,*.msg,All Files,*.*", 1, "Pick the file", , MultiSelect:=True)
If IsArray(vFile) Then
For I = 1 To UBound(vFile)
lcl_a_fn = Split(vFile(I), "\")
lcl_vIconLabel = lcl_a_fn(UBound(lcl_a_fn))
Set objI = ActiveSheet.OLEObjects.Add(Filename:=vFile(I), Link:=False, DisplayAsIcon:=True, IconFileName:="C:\Windows\Installer\{90140000-0011-0000-0000-0000000FF1CE}\msouc.exe", _
IconIndex:=0, IconLabel:=lcl_vIconLabel & Space(1) & Date & Space(1), Top:=114, Left:=541)
objI.Width = 40
objI.Height = 40
Next I
Else
Exit Sub
End If
End Sub
Last edited: