Hi,
I have the below code which I thought worked well for my purpose (lifted from somewhere else on the internet), but it is not quite working. I have a command button which does the same as 'Insert >> Object >> Display as Icon' etc.
Unfortunately, it could be any file that it is attached as (ie PDF, excel, word...) so I can't be specific. The issue is that when it gets emailed, the other person cannot open the file. only it shows a link to the directory where it came from.
Private Sub Embed1()
Dim vFile As Variant
Range("H26").Select
vFile = Application.GetOpenFilename("All Files,*.*", Title:="Find file to insert")
If LCase(vFile) = "false" Then Exit Sub
ActiveSheet.OLEObjects.Add Filename:=vFile, Link:=True, DisplayAsIcon:=True, IconFileName:= _
"C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe", _
IconIndex:=0, IconLabel:=vFile
End Sub
Private Sub CommandButton2_Click()
Call Embed1
End Sub
any help would be appreciated.
MTIA.
Bookmarks