I want to add more files into my excel file. This macro works if multiselect is false, however if I try it with multiselect = true, I get an error message in row:
if attachment = false then exit sub. An error message was type mismatch.
Sub insertObject()
Dim attachment As Variant
'open more files, but not from specific folder
attachment = Application.GetOpenFilename(FileFilter:="All Files (*.*), *.*", MultiSelect:=True)
'if attachment is missing then end macro
If attachment = False Then Exit Sub
'my try with OLEobjects
ActiveSheet.OLEObjects.Add(Filename:=attachment, Link:=False, DisplayAsIcon:=True, IconFileName:="C:\WINDOWS\system32\packager.dll", IconIndex:=1, IconLabel:=attachment).Select
End Sub