![]() |
Insert obect
Hi
I'm trying to create a button that replicates InsertObject, then from file as icon. I've tried recording the action but it either record nothing if i choose no file, or the test file location but then i can figure out how to make sort of prompt? Does anyone know who to do this? All help is appreciated -- _______________________ Naz, London |
Insert obect
You can open a dailog method like below
dlgAnswer = Application.Dialogs(xlDialogOpen).Show "Naz" wrote: Hi I'm trying to create a button that replicates InsertObject, then from file as icon. I've tried recording the action but it either record nothing if i choose no file, or the test file location but then i can figure out how to make sort of prompt? Does anyone know who to do this? All help is appreciated -- _______________________ Naz, London |
Insert obect
Try this
Sub Uploader() filetoOpen = Application _ .GetOpenFilename("Excel Files (*.xls), *.xls") If filetoOpen = False Then MsgBox "Cannot Open file - Exiting Macro" Exit Sub End If Set newobj = ActiveSheet.OLEObjects.Add( _ Filename:=filetoOpen, _ Link:=False, _ DisplayAsIcon:=True, _ IconFileName:= _ "C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe", _ IconIndex:=0, _ IconLabel:=filetoOpen) End Sub "Naz" wrote: Hi Joel thanks But where would i put that line in the code Sub Uploader() Workbooks.Open Filename:="C:\Book1.xls" ActiveWindow.Visible = False ActiveSheet.OLEObjects.Add(Filename:= _ "C:\Book1.xls", Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe", _ IconIndex:=0, IconLabel:="C:\Book1.xls" _ ).Select End Sub -- _______________________ Naz, London "Joel" wrote: You can open a dailog method like below dlgAnswer = Application.Dialogs(xlDialogOpen).Show "Naz" wrote: Hi I'm trying to create a button that replicates InsertObject, then from file as icon. I've tried recording the action but it either record nothing if i choose no file, or the test file location but then i can figure out how to make sort of prompt? Does anyone know who to do this? All help is appreciated -- _______________________ Naz, London |
Insert obect
That works many thanks !!
-- _______________________ Naz, London "Joel" wrote: Try this Sub Uploader() filetoOpen = Application _ .GetOpenFilename("Excel Files (*.xls), *.xls") If filetoOpen = False Then MsgBox "Cannot Open file - Exiting Macro" Exit Sub End If Set newobj = ActiveSheet.OLEObjects.Add( _ Filename:=filetoOpen, _ Link:=False, _ DisplayAsIcon:=True, _ IconFileName:= _ "C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe", _ IconIndex:=0, _ IconLabel:=filetoOpen) End Sub "Naz" wrote: Hi Joel thanks But where would i put that line in the code Sub Uploader() Workbooks.Open Filename:="C:\Book1.xls" ActiveWindow.Visible = False ActiveSheet.OLEObjects.Add(Filename:= _ "C:\Book1.xls", Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe", _ IconIndex:=0, IconLabel:="C:\Book1.xls" _ ).Select End Sub -- _______________________ Naz, London "Joel" wrote: You can open a dailog method like below dlgAnswer = Application.Dialogs(xlDialogOpen).Show "Naz" wrote: Hi I'm trying to create a button that replicates InsertObject, then from file as icon. I've tried recording the action but it either record nothing if i choose no file, or the test file location but then i can figure out how to make sort of prompt? Does anyone know who to do this? All help is appreciated -- _______________________ Naz, London |
Insert obect
Hi Joel thanks
But where would i put that line in the code Sub Uploader() Workbooks.Open Filename:="C:\Book1.xls" ActiveWindow.Visible = False ActiveSheet.OLEObjects.Add(Filename:= _ "C:\Book1.xls", Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINDOWS\Installer\{90110409-6000-11D3-8CFE-0150048383C9}\xlicons.exe", _ IconIndex:=0, IconLabel:="C:\Book1.xls" _ ).Select End Sub -- _______________________ Naz, London "Joel" wrote: You can open a dailog method like below dlgAnswer = Application.Dialogs(xlDialogOpen).Show "Naz" wrote: Hi I'm trying to create a button that replicates InsertObject, then from file as icon. I've tried recording the action but it either record nothing if i choose no file, or the test file location but then i can figure out how to make sort of prompt? Does anyone know who to do this? All help is appreciated -- _______________________ Naz, London |
All times are GMT +1. The time now is 08:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com