VBA Email file upload

mef1sto

Board Regular
Joined
Oct 31, 2013
Messages
85
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:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Another remark would be that after i save and it totally messes up the uploaded files icon and label's icon, if i right click the uploaded file and go to Packager Shell Object Object and select rename package i have this Rename Package option where i can rewrite the label as i please and after Saving, it actually saves the uploaded file's label name, which i so much want to be able to do that automatically, not by this manner. So please figure out this gibberish problem, thank you!
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,816
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top