ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Opening An External File (https://www.excelbanter.com/excel-discussion-misc-queries/244533-opening-external-file.html)

Matthew[_2_]

Opening An External File
 
I am trying to write what should be a fairly simple thing....

I need the user to be able to select a report thorugh drop down menus,
then an example of this is shown on the screen, I can do this using
one of J.E. McGimpsey's brilliant macros.

I would then like thbe user to be able to click a buttone and the
actual report (usualy pdf) to open, not to hard I thought........

I have a total of 80 reports all stored in the one file with sensible
names.

Can anyone help ?

Matthew

joel

Opening An External File
 
You need to use the shell command and specify the complete path of where the
adobe reader is located on your PC. Note the is a space between the adobe
path and the file name

Adobe = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"
Shell (Adobe & " c:\temp\bell.pdf")


Adobe may be located in a different location on your PC. You may need to
search the c drive to find where adobe is located if you plan to use the
macro on other PC's.

You can use filesearch for locating the adobe reader. I'm searching the
entire c: drive. You may want to use a path like "C:\Program Files instead
of c:.


msgbox("Searching for adobe - this may take a couple of minutes")
With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = True
.Filename = "AcroRd32.exe"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute() = 0 Then
MsgBox ("Cannot find adobe - exiting macro")
Exit Sub
Else
adobe = .FoundFiles.Item(1)

End If
End With




"Matthew" wrote:

I am trying to write what should be a fairly simple thing....

I need the user to be able to select a report thorugh drop down menus,
then an example of this is shown on the screen, I can do this using
one of J.E. McGimpsey's brilliant macros.

I would then like thbe user to be able to click a buttone and the
actual report (usualy pdf) to open, not to hard I thought........

I have a total of 80 reports all stored in the one file with sensible
names.

Can anyone help ?

Matthew


Matthew[_2_]

Opening An External File
 
On 4 Oct, 21:26, Joel wrote:
You need to use the shell command and specify the complete path of where the
adobe reader is located on your PC. *Note the is a space between the adobe
path and the file name

Adobe = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"
Shell (Adobe & " c:\temp\bell.pdf")

Adobe may be located in a different location on your PC. *You may need to
search the c drive to find where adobe is located if you plan to use the
macro on other PC's.

You can use filesearch for locating the adobe reader. *I'm searching the
entire c: drive. *You may want to use a path like "C:\Program Files instead
of c:.

msgbox("Searching for adobe - this may take a couple of minutes")
With Application.FileSearch
* * .NewSearch
* * .LookIn = "C:\"
* * .SearchSubFolders = True
* * .Filename = "AcroRd32.exe"
* * .MatchTextExactly = True
* * .FileType = msoFileTypeAllFiles
* * If .Execute() = 0 Then
* * * *MsgBox ("Cannot find adobe - exiting macro")
* * * *Exit Sub
* * Else
* * * *adobe = .FoundFiles.Item(1)

* * End If
End With

"Matthew" wrote:
I am trying to write what should be a fairly simple thing....


I need the user to be able to select a report thorugh drop down menus,
then an example of this is shown on the screen, I can do this using
one of J.E. McGimpsey's brilliant macros.


I would then like thbe user to be able to click a buttone and the
actual report (usualy pdf) to open, not to hard I thought........


I have a total of 80 reports all stored in the one file with sensible
names.


Can anyone help ?


Matthew


Wowsie, I guessed it was tough.......in the end I have cheated a
little and put a 'fix' in.
Thanks for your help though all is stored away for when I run out of
ideas !!!

joel

Opening An External File
 
I found a better method in a posting today. Much easier to impliment

retValue = Shell("C:\Windows\explorer.exe c:\temp\test.pdf", vbNormalFocus)

the file name is in the shell and will automatically open the PDF in a
window explorer in an IE explorer type window. Don't need to find where the
adobe application is located.

"Matthew" wrote:

On 4 Oct, 21:26, Joel wrote:
You need to use the shell command and specify the complete path of where the
adobe reader is located on your PC. Note the is a space between the adobe
path and the file name

Adobe = "C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe"
Shell (Adobe & " c:\temp\bell.pdf")

Adobe may be located in a different location on your PC. You may need to
search the c drive to find where adobe is located if you plan to use the
macro on other PC's.

You can use filesearch for locating the adobe reader. I'm searching the
entire c: drive. You may want to use a path like "C:\Program Files instead
of c:.

msgbox("Searching for adobe - this may take a couple of minutes")
With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = True
.Filename = "AcroRd32.exe"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
If .Execute() = 0 Then
MsgBox ("Cannot find adobe - exiting macro")
Exit Sub
Else
adobe = .FoundFiles.Item(1)

End If
End With

"Matthew" wrote:
I am trying to write what should be a fairly simple thing....


I need the user to be able to select a report thorugh drop down menus,
then an example of this is shown on the screen, I can do this using
one of J.E. McGimpsey's brilliant macros.


I would then like thbe user to be able to click a buttone and the
actual report (usualy pdf) to open, not to hard I thought........


I have a total of 80 reports all stored in the one file with sensible
names.


Can anyone help ?


Matthew


Wowsie, I guessed it was tough.......in the end I have cheated a
little and put a 'fix' in.
Thanks for your help though all is stored away for when I run out of
ideas !!!



All times are GMT +1. The time now is 07:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com