I need some help on a VBA code. I want to insert other files in an excel file which is displayed as an icon and give the icon a specific name. I used this code:
Dim fn
fn = Application.GetOpenFilename
If fn = False Then
Exit Sub
End If
name = InputBox("give the file a name")
ActiveSheet.OLEObjects.Add(Filename:=fn, Link:=False, DisplayAsIcon:=True, IconFileName:= _
"C:\Program Files\Internet Explorer\iexplore.exe", _
IconIndex:=4, IconLabel:=name).Select
Selection.Left = 1000
End Sub
The file that is inserted opens in the background when it is inserted. It is not visible but it remains open. I would like the macro to automatically close the file without saving changes after it was inserted in the excel file .
Does anybody know how to add this to the code?
thank you for the help!!
Dim fn
fn = Application.GetOpenFilename
If fn = False Then
Exit Sub
End If
name = InputBox("give the file a name")
ActiveSheet.OLEObjects.Add(Filename:=fn, Link:=False, DisplayAsIcon:=True, IconFileName:= _
"C:\Program Files\Internet Explorer\iexplore.exe", _
IconIndex:=4, IconLabel:=name).Select
Selection.Left = 1000
End Sub
The file that is inserted opens in the background when it is inserted. It is not visible but it remains open. I would like the macro to automatically close the file without saving changes after it was inserted in the excel file .
Does anybody know how to add this to the code?
thank you for the help!!