Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello, I wonder if anyone can help. I am trying to create a Macro to insert
an object (any type of file .xls.jog.pdf.doc etc etc) in an excel workbook to a specific location. I want the macro to perform the following excel command: Select the location of the file to be inserted select €śInsert€ť from the menu bar and then Object move to tab €śCreate from List€ť tick the box €śdisplay as icon€ť and then allow the user to browse and select the file they wish to insert. I also want to inserted file to be in a specific location in the worksheet. Thanks a million excellers!!! |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The code below works for pdf files. A got the basic code from a learn macro.
the location of the ICON may be different on your PC. don't know enough about the subject. for a Text file it will display the pdf icon. It looks like you may havve tto modify the program for each type file you want to add. check the extension on the file and the use a diffferent ICON for each file type. Sub InsertObject() MyFileName = Application.GetOpenFilename("") CellLocation = InputBox("Enter Cell Location") CellLocation = "" + CellLocation + "" ActiveSheet.Range(CellLocation).Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Lester from AUS" wrote: Hello, I wonder if anyone can help. I am trying to create a Macro to insert an object (any type of file .xls.jog.pdf.doc etc etc) in an excel workbook to a specific location. I want the macro to perform the following excel command: Select the location of the file to be inserted select €śInsert€ť from the menu bar and then Object move to tab €śCreate from List€ť tick the box €śdisplay as icon€ť and then allow the user to browse and select the file they wish to insert. I also want to inserted file to be in a specific location in the worksheet. Thanks a million excellers!!! |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Joel,
Sub InsertObject2() MyFileName = Application.GetOpenFilename("") ActiveSheet.Range("h15").Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=True, _ DisplayAsIcon:=True, IconFileName:="C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Joel" wrote: The code below works for pdf files. A got the basic code from a learn macro. the location of the ICON may be different on your PC. don't know enough about the subject. for a Text file it will display the pdf icon. It looks like you may havve tto modify the program for each type file you want to add. check the extension on the file and the use a diffferent ICON for each file type. Sub InsertObject() MyFileName = Application.GetOpenFilename("") CellLocation = InputBox("Enter Cell Location") CellLocation = "" + CellLocation + "" ActiveSheet.Range(CellLocation).Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Lester from AUS" wrote: Hello, I wonder if anyone can help. I am trying to create a Macro to insert an object (any type of file .xls.jog.pdf.doc etc etc) in an excel workbook to a specific location. I want the macro to perform the following excel command: Select the location of the file to be inserted select €śInsert€ť from the menu bar and then Object move to tab €śCreate from List€ť tick the box €śdisplay as icon€ť and then allow the user to browse and select the file they wish to insert. I also want to inserted file to be in a specific location in the worksheet. Thanks a million excellers!!! |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Lester: Do you need additional help. All you sent was updted code with no
comments. "Lester from AUS" wrote: Hi Joel, Sub InsertObject2() MyFileName = Application.GetOpenFilename("") ActiveSheet.Range("h15").Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=True, _ DisplayAsIcon:=True, IconFileName:="C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Joel" wrote: The code below works for pdf files. A got the basic code from a learn macro. the location of the ICON may be different on your PC. don't know enough about the subject. for a Text file it will display the pdf icon. It looks like you may havve tto modify the program for each type file you want to add. check the extension on the file and the use a diffferent ICON for each file type. Sub InsertObject() MyFileName = Application.GetOpenFilename("") CellLocation = InputBox("Enter Cell Location") CellLocation = "" + CellLocation + "" ActiveSheet.Range(CellLocation).Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Lester from AUS" wrote: Hello, I wonder if anyone can help. I am trying to create a Macro to insert an object (any type of file .xls.jog.pdf.doc etc etc) in an excel workbook to a specific location. I want the macro to perform the following excel command: Select the location of the file to be inserted select €śInsert€ť from the menu bar and then Object move to tab €śCreate from List€ť tick the box €śdisplay as icon€ť and then allow the user to browse and select the file they wish to insert. I also want to inserted file to be in a specific location in the worksheet. Thanks a million excellers!!! |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Joel,
Sorry mate must have deleted the comments by error. The sub worked perfectly, thanks a lot for your help. I just wanted to let you know that I needed to make some slight changes as noted in the sub I sent. Basically, I changed the Link to True and defined a location to attach the file. This now works for All Files. Thanks again Joel, you are a champ!!! "Joel" wrote: Lester: Do you need additional help. All you sent was updted code with no comments. "Lester from AUS" wrote: Hi Joel, Sub InsertObject2() MyFileName = Application.GetOpenFilename("") ActiveSheet.Range("h15").Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=True, _ DisplayAsIcon:=True, IconFileName:="C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Joel" wrote: The code below works for pdf files. A got the basic code from a learn macro. the location of the ICON may be different on your PC. don't know enough about the subject. for a Text file it will display the pdf icon. It looks like you may havve tto modify the program for each type file you want to add. check the extension on the file and the use a diffferent ICON for each file type. Sub InsertObject() MyFileName = Application.GetOpenFilename("") CellLocation = InputBox("Enter Cell Location") CellLocation = "" + CellLocation + "" ActiveSheet.Range(CellLocation).Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Lester from AUS" wrote: Hello, I wonder if anyone can help. I am trying to create a Macro to insert an object (any type of file .xls.jog.pdf.doc etc etc) in an excel workbook to a specific location. I want the macro to perform the following excel command: Select the location of the file to be inserted select €śInsert€ť from the menu bar and then Object move to tab €śCreate from List€ť tick the box €śdisplay as icon€ť and then allow the user to browse and select the file they wish to insert. I also want to inserted file to be in a specific location in the worksheet. Thanks a million excellers!!! |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Joel,
Sorry mate I still need your help. When I use link=True, the file can not be opened once emailed. You mentioned that your sub works for PDF files, but it actually does not. It works for all other files (Excel, word, outlook) but not PDF. Is this because the setting in my computer? I have tried changing the IconFileName:=, but still can not get it working for PDF. Any help would be much appreciated€¦ Many thanks "Lester from AUS" wrote: Joel, Sorry mate must have deleted the comments by error. The sub worked perfectly, thanks a lot for your help. I just wanted to let you know that I needed to make some slight changes as noted in the sub I sent. Basically, I changed the Link to True and defined a location to attach the file. This now works for All Files. Thanks again Joel, you are a champ!!! "Joel" wrote: Lester: Do you need additional help. All you sent was updted code with no comments. "Lester from AUS" wrote: Hi Joel, Sub InsertObject2() MyFileName = Application.GetOpenFilename("") ActiveSheet.Range("h15").Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=True, _ DisplayAsIcon:=True, IconFileName:="C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Joel" wrote: The code below works for pdf files. A got the basic code from a learn macro. the location of the ICON may be different on your PC. don't know enough about the subject. for a Text file it will display the pdf icon. It looks like you may havve tto modify the program for each type file you want to add. check the extension on the file and the use a diffferent ICON for each file type. Sub InsertObject() MyFileName = Application.GetOpenFilename("") CellLocation = InputBox("Enter Cell Location") CellLocation = "" + CellLocation + "" ActiveSheet.Range(CellLocation).Activate ActiveSheet.OLEObjects.Add(Filename:=MyFileName, Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINNT\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:=MyFileName).Select End Sub "Lester from AUS" wrote: Hello, I wonder if anyone can help. I am trying to create a Macro to insert an object (any type of file .xls.jog.pdf.doc etc etc) in an excel workbook to a specific location. I want the macro to perform the following excel command: Select the location of the file to be inserted select €śInsert€ť from the menu bar and then Object move to tab €śCreate from List€ť tick the box €śdisplay as icon€ť and then allow the user to browse and select the file they wish to insert. I also want to inserted file to be in a specific location in the worksheet. Thanks a million excellers!!! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert large excel object into word | Excel Discussion (Misc queries) | |||
How do i insert an outlook msg file object in excel | Excel Worksheet Functions | |||
Insert Object | Excel Discussion (Misc queries) | |||
How do I insert a 2-3 page Excel spreadsheet as an object in MS Wo | Excel Discussion (Misc queries) | |||
Create .NET object written in C# in Excel Macro | Excel Discussion (Misc queries) |