Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert/Embed PDF File automatically via VBA
I'm trying to create a little program where it will allow a user to embed a
PDF file so we can maintain records. I've done the record macro and recorded the action of Insert-Object-Create from File, however it forces you to select a file. And in the code, it puts the file name you select. This is an issue as the user may save the PDF file as a different name than preprogrammed. So is it possible to have VBA automatically open the Insert-Object-Create from File-Browse file box to allow the user to select the PDF file? Below is the code to automatically add a prenamed PDF file and it works fine, just doesn't give the user the option to select the file they want to insert. Thanks in advanced. ------------------------ Sub Macro3() ' ' Macro3 Macro ' Macro recorded 8/5/2008 by bhodge ' ' ActiveSheet.OLEObjects.Add(Filename:= _ "C:\Documents and Settings\bhodge\Desktop\test2.pdf", Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINDOWS\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:= _ "C:\Documents and Settings\bhodge\Desktop\test2.pdf").Select End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert/Embed PDF File automatically via VBA
MsgBox "Enter the your file"
MyFile = Application.GetOpenFilename If MyFile = "False" Then Exit Sub HTH -- Ak "Brad" wrote: I'm trying to create a little program where it will allow a user to embed a PDF file so we can maintain records. I've done the record macro and recorded the action of Insert-Object-Create from File, however it forces you to select a file. And in the code, it puts the file name you select. This is an issue as the user may save the PDF file as a different name than preprogrammed. So is it possible to have VBA automatically open the Insert-Object-Create from File-Browse file box to allow the user to select the PDF file? Below is the code to automatically add a prenamed PDF file and it works fine, just doesn't give the user the option to select the file they want to insert. Thanks in advanced. ------------------------ Sub Macro3() ' ' Macro3 Macro ' Macro recorded 8/5/2008 by bhodge ' ' ActiveSheet.OLEObjects.Add(Filename:= _ "C:\Documents and Settings\bhodge\Desktop\test2.pdf", Link:=False, _ DisplayAsIcon:=True, IconFileName:= _ "C:\WINDOWS\Installer\{AC76BA86-7AD7-1033-7B44-A70000000000}\PDFFile.ico", _ IconIndex:=0, IconLabel:= _ "C:\Documents and Settings\bhodge\Desktop\test2.pdf").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
can I insert/embed a word document in a single excel cell? | Excel Discussion (Misc queries) | |||
how do i automatically insert a file name into a formula from a ta | Excel Discussion (Misc queries) | |||
How to embed a PDF file into a userform | Excel Programming | |||
Can XLS automatically insert file properties fields into a header | Excel Worksheet Functions | |||
Can you automatically insert a file path in an Excel document? | Excel Discussion (Misc queries) |