B
Brad
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
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