Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 33
Default Open pdf from a cell

I would like to open a pdf file on m disk drive from a cell. I can get
hyperlink to work but the program that generates the pdf adds #1 to
the file if it has been revised. So I have file like this

C:\testfile.pdf ( which works)
C:\testfile#1.pdf (does not wotk with hyperlink)

=HYPERLINK("C:\testfile.pdf","open file") this will work

=HYPERLINK("C:\testfile#1.pdf","open file") this will not work

The problem is the "#" character.
Hyperlink does not like wildcards or I am not using the right format.

I have over 500 files and more than half hve the #1 or #2 or #3

Is ther another way to open the file other than hyperlink?

Any ideas? This is the 3rd excel group I posted the question to with
no answers.

I would appreciate any help on this.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Open pdf from a cell

Could you use a macro?

This worked for me with xl2003 and WinXP Home:

Dim myFileName As String
myFileName = "c:\my documents\excel\test#1.pdf"
Shell Environ("comspec") & " /c " & Chr(34) & myFileName & Chr(34), vbHide

Maybe you could plop a button from the Forms toolbar on row 1 of your
worksheet. Then use window|freeze panes to make sure that button is always
visible.

Then tell the user to select the cell with the pdf filename in it and click the
button.

You can assign this macro to the button:

Option Explicit
Sub testme()

Dim myFileName As String
Dim TestStr As String

myFileName = ActiveCell.Value

If myFileName = "" Then
Beep
Else
TestStr = ""
On Error Resume Next
TestStr = Dir(myFileName)
On Error GoTo 0

If TestStr = "" Then
'file wasn't found
Beep
MsgBox "That file wasn't found"
Else
Shell Environ("comspec") _
& " /c " & Chr(34) & myFileName & Chr(34), vbHide
End If
End If

End Sub

The Shell command opens a Command window that starts the program associated with
the .pdf extension (for me Adobe Reader).

The /c says to close that (hidden!) window when it's done (after the user closes
the .pdf file).

Change /k to see the command window (/k = keep open???).





rpick60 wrote:

I would like to open a pdf file on m disk drive from a cell. I can get
hyperlink to work but the program that generates the pdf adds #1 to
the file if it has been revised. So I have file like this

C:\testfile.pdf ( which works)
C:\testfile#1.pdf (does not wotk with hyperlink)

=HYPERLINK("C:\testfile.pdf","open file") this will work

=HYPERLINK("C:\testfile#1.pdf","open file") this will not work

The problem is the "#" character.
Hyperlink does not like wildcards or I am not using the right format.

I have over 500 files and more than half hve the #1 or #2 or #3

Is ther another way to open the file other than hyperlink?

Any ideas? This is the 3rd excel group I posted the question to with
no answers.

I would appreciate any help on this.

Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Open pdf from a cell

ps. I'd go back to the developer and ask them to change that # to an underscore
or hyphen.


rpick60 wrote:

I would like to open a pdf file on m disk drive from a cell. I can get
hyperlink to work but the program that generates the pdf adds #1 to
the file if it has been revised. So I have file like this

C:\testfile.pdf ( which works)
C:\testfile#1.pdf (does not wotk with hyperlink)

=HYPERLINK("C:\testfile.pdf","open file") this will work

=HYPERLINK("C:\testfile#1.pdf","open file") this will not work

The problem is the "#" character.
Hyperlink does not like wildcards or I am not using the right format.

I have over 500 files and more than half hve the #1 or #2 or #3

Is ther another way to open the file other than hyperlink?

Any ideas? This is the 3rd excel group I posted the question to with
no answers.

I would appreciate any help on this.

Thanks


--

Dave Peterson
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
open a new line in a cell Xero Excel Discussion (Misc queries) 2 June 9th 07 08:46 PM
how to open the hidden cell ? vh928 Excel Discussion (Misc queries) 2 January 7th 07 06:44 AM
open to cell dpb0180 Excel Discussion (Misc queries) 0 March 29th 06 11:42 AM
How to get pointer in new cell on Open? Jazz Drummer Excel Worksheet Functions 2 October 9th 05 03:13 PM
Can't open doc. Too many different cell formats. Steven Excel Discussion (Misc queries) 3 March 25th 05 07:56 PM


All times are GMT +1. The time now is 11:13 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"