Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can I insert/embed a word document in a single excel cell? hamishburn Excel Discussion (Misc queries) 1 August 20th 08 10:41 AM
how do i automatically insert a file name into a formula from a ta AMabin Excel Discussion (Misc queries) 2 February 27th 07 06:53 PM
How to embed a PDF file into a userform Incidental Excel Programming 0 November 10th 06 10:13 AM
Can XLS automatically insert file properties fields into a header Margaret Johnson Excel Worksheet Functions 1 June 1st 06 03:43 AM
Can you automatically insert a file path in an Excel document? Mimi Excel Discussion (Misc queries) 2 March 22nd 06 12:10 AM


All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"