Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Embed PDF and select file name and path

Hi All,

Im looking for a way to not only insert/embed an object into my worksheet
(which works below), but have the directory select the file based on an
existing PDF named file. I have users entering data into certain cells which
in turn uses a formula to concatenate their entries into cell A1. This cell
will be the name of the file thats already residing out on the noted path.
So far, I can only get it to embed the file when the name is static
(hardcoded name in question mark fields). Id like to instead have it select
the file based on the name in the A1 cell. The worksheet is called Sheet1
and again the cell that names the PDF is A1.

Any thoughts or ideas on how to make this happen?

Thanks in advance €“ Jenny B.




Sub InsertNamedObject()

ActiveSheet.OLEObjects.Add(Filename:= _
"C:\Documents and Settings\Jenny B.\My Documents\???????", Link:= _
False, DisplayAsIcon:=True, IconFileName:= _

"C:\WINDOWS\Installer\{AC76BA86-1033-F400-7760-000000000004}\_PDFFile.ico", _
IconIndex:=0, IconLabel:= _
"C:\Documents and Settings\Jenny B\My
Documents\BKA1303005.PDF").Select

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Embed PDF and select file name and path

Something like the below...

Sub InsertNamedObject()

Dim strFile As String
'If sheet1 is the active sheet
strFile = Trim(Activesheet.Range("A1"))

'If Sheet1 is not the active sheet
'strFile = Trim(Sheets("Sheet1").Range("A1"))

ActiveSheet.OLEObjects.Add(Filename:= _
"C:\Documents and Settings\Jenny B.\My Documents\" & strFile, Link:= _
False, DisplayAsIcon:=True, IconFileName:= _
C:\WINDOWS\Installer\{AC76BA86-1033-F400-7760-000000000004}
_PDFFile.ico", _
IconIndex:=0, IconLabel:= _
"C:\Documents and Settings\Jenny B\My Documents\BKA1303005.PDF").Select

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jenny B." wrote:

Hi All,

Im looking for a way to not only insert/embed an object into my worksheet
(which works below), but have the directory select the file based on an
existing PDF named file. I have users entering data into certain cells which
in turn uses a formula to concatenate their entries into cell A1. This cell
will be the name of the file thats already residing out on the noted path.
So far, I can only get it to embed the file when the name is static
(hardcoded name in question mark fields). Id like to instead have it select
the file based on the name in the A1 cell. The worksheet is called Sheet1
and again the cell that names the PDF is A1.

Any thoughts or ideas on how to make this happen?

Thanks in advance €“ Jenny B.




Sub InsertNamedObject()

ActiveSheet.OLEObjects.Add(Filename:= _
"C:\Documents and Settings\Jenny B.\My Documents\???????", Link:= _
False, DisplayAsIcon:=True, IconFileName:= _

"C:\WINDOWS\Installer\{AC76BA86-1033-F400-7760-000000000004}\_PDFFile.ico", _
IconIndex:=0, IconLabel:= _
"C:\Documents and Settings\Jenny B\My
Documents\BKA1303005.PDF").Select

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Embed PDF and select file name and path

That did it!

Thank you very much for taking the time to reply and appreciate the prompt
response.

Jenny B.


"Jacob Skaria" wrote:

Something like the below...

Sub InsertNamedObject()

Dim strFile As String
'If sheet1 is the active sheet
strFile = Trim(Activesheet.Range("A1"))

'If Sheet1 is not the active sheet
'strFile = Trim(Sheets("Sheet1").Range("A1"))

ActiveSheet.OLEObjects.Add(Filename:= _
"C:\Documents and Settings\Jenny B.\My Documents\" & strFile, Link:= _
False, DisplayAsIcon:=True, IconFileName:= _
C:\WINDOWS\Installer\{AC76BA86-1033-F400-7760-000000000004}
_PDFFile.ico", _
IconIndex:=0, IconLabel:= _
"C:\Documents and Settings\Jenny B\My Documents\BKA1303005.PDF").Select

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jenny B." wrote:

Hi All,

Im looking for a way to not only insert/embed an object into my worksheet
(which works below), but have the directory select the file based on an
existing PDF named file. I have users entering data into certain cells which
in turn uses a formula to concatenate their entries into cell A1. This cell
will be the name of the file thats already residing out on the noted path.
So far, I can only get it to embed the file when the name is static
(hardcoded name in question mark fields). Id like to instead have it select
the file based on the name in the A1 cell. The worksheet is called Sheet1
and again the cell that names the PDF is A1.

Any thoughts or ideas on how to make this happen?

Thanks in advance €“ Jenny B.




Sub InsertNamedObject()

ActiveSheet.OLEObjects.Add(Filename:= _
"C:\Documents and Settings\Jenny B.\My Documents\???????", Link:= _
False, DisplayAsIcon:=True, IconFileName:= _

"C:\WINDOWS\Installer\{AC76BA86-1033-F400-7760-000000000004}\_PDFFile.ico", _
IconIndex:=0, IconLabel:= _
"C:\Documents and Settings\Jenny B\My
Documents\BKA1303005.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
embed alignment in csv file Abbey Normal Excel Discussion (Misc queries) 3 July 26th 07 03:42 PM
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
How do I embed an email in an excel file? Dan_man Excel Discussion (Misc queries) 0 September 26th 06 06:35 PM
how do i embed a file in a workbook IAN C Excel Discussion (Misc queries) 2 April 28th 06 04:27 PM
How do I embed a PDF file within Excel Eddy05 Excel Discussion (Misc queries) 1 January 25th 05 08:37 PM


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

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

About Us

"It's about Microsoft Excel"