Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Open files from a dynamic path..

Hi al..

I have a problem.. I placed the question here last week aswell, unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open certain
adobe PDF files. Furthermore, this project is to be burned on a CD so it can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation and open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Open files from a dynamic path..

Arjan,
Depends where the PDFs are relative to the Excel WB. You already have
ThisWorkbook.Path, so if they in a sub folder of that :
ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf"

If you maybe on Mac then you would need to do bit work at detecting that
first.

NickHK

"Arjan" wrote in message
...
Hi al..

I have a problem.. I placed the question here last week aswell,

unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open certain
adobe PDF files. Furthermore, this project is to be burned on a CD so it

can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation and open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Open files from a dynamic path..

Nick,

Thanks for your reply.. The files are in the same path as the workbook.
However, what I don't know is the how to open the file(s)..

what code do I have to use?

Arjan




--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

Arjan,
Depends where the PDFs are relative to the Excel WB. You already have
ThisWorkbook.Path, so if they in a sub folder of that :
ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf"

If you maybe on Mac then you would need to do bit work at detecting that
first.

NickHK

"Arjan" wrote in message
...
Hi al..

I have a problem.. I placed the question here last week aswell,

unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open certain
adobe PDF files. Furthermore, this project is to be burned on a CD so it

can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation and open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Open files from a dynamic path..

If you just want to open them in the user's defualt app for pdf files :

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
_
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1

NickHK

"Arjan" wrote in message
...
Nick,

Thanks for your reply.. The files are in the same path as the workbook.
However, what I don't know is the how to open the file(s)..

what code do I have to use?

Arjan




--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

Arjan,
Depends where the PDFs are relative to the Excel WB. You already have
ThisWorkbook.Path, so if they in a sub folder of that :
ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf"

If you maybe on Mac then you would need to do bit work at detecting that
first.

NickHK

"Arjan" wrote in message
...
Hi al..

I have a problem.. I placed the question here last week aswell,

unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open

certain
adobe PDF files. Furthermore, this project is to be burned on a CD so

it
can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation and

open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Open files from a dynamic path..

Are you using a fileopen dialog box for the user to select the file?

If not, you could try using it...it will return you the entire path of
the selected file/folder

check FileDialog Property in help.

HTH
-Satish

Arjan wrote:
Hi al..

I have a problem.. I placed the question here last week aswell, unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open certain
adobe PDF files. Furthermore, this project is to be burned on a CD so it can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation and open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Open files from a dynamic path..

Nick,

Sorry to bother you again..
I tried to insert the code, unfortunalty there's a compile-error which
states that
it expects a rulenumber or a name or a instruction or a instruction-end..

I do have to put the code in the command button sub? Or do I make a mistake?



--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

If you just want to open them in the user's defualt app for pdf files :

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
_
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1

NickHK

"Arjan" wrote in message
...
Nick,

Thanks for your reply.. The files are in the same path as the workbook.
However, what I don't know is the how to open the file(s)..

what code do I have to use?

Arjan




--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

Arjan,
Depends where the PDFs are relative to the Excel WB. You already have
ThisWorkbook.Path, so if they in a sub folder of that :
ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf"

If you maybe on Mac then you would need to do bit work at detecting that
first.

NickHK

"Arjan" wrote in message
...
Hi al..

I have a problem.. I placed the question here last week aswell,
unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open

certain
adobe PDF files. Furthermore, this project is to be burned on a CD so

it
can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation and

open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Open files from a dynamic path..

Nick, sorry to bother you again...

When i put this code in the commandbutton sub it returns a complie error.
It suspects a rulenumber, a name an instruction or an instruction end.

I do have tp put this code in the commandbutton sub? or do i make a mistake?

thanks again for your help!

Arjan


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

If you just want to open them in the user's defualt app for pdf files :

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
_
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1

NickHK

"Arjan" wrote in message
...
Nick,

Thanks for your reply.. The files are in the same path as the workbook.
However, what I don't know is the how to open the file(s)..

what code do I have to use?

Arjan




--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

Arjan,
Depends where the PDFs are relative to the Excel WB. You already have
ThisWorkbook.Path, so if they in a sub folder of that :
ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf"

If you maybe on Mac then you would need to do bit work at detecting that
first.

NickHK

"Arjan" wrote in message
...
Hi al..

I have a problem.. I placed the question here last week aswell,
unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open

certain
adobe PDF files. Furthermore, this project is to be burned on a CD so

it
can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation and

open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Open files from a dynamic path..

Arjan,
OK, this a bit more correct :

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Private Sub CommandButton1_Click()
ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1
End Sub

NickHK

"Arjan" wrote in message
...
Nick,

Sorry to bother you again..
I tried to insert the code, unfortunalty there's a compile-error which
states that
it expects a rulenumber or a name or a instruction or a instruction-end..

I do have to put the code in the command button sub? Or do I make a

mistake?



--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

If you just want to open them in the user's defualt app for pdf files :

Public Declare Function ShellExecute Lib "shell32.dll" Alias

"ShellExecuteA"
_
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1

NickHK

"Arjan" wrote in message
...
Nick,

Thanks for your reply.. The files are in the same path as the

workbook.
However, what I don't know is the how to open the file(s)..

what code do I have to use?

Arjan




--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

Arjan,
Depends where the PDFs are relative to the Excel WB. You already

have
ThisWorkbook.Path, so if they in a sub folder of that :
ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf"

If you maybe on Mac then you would need to do bit work at detecting

that
first.

NickHK

"Arjan" wrote in message
...
Hi al..

I have a problem.. I placed the question here last week aswell,
unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open

certain
adobe PDF files. Furthermore, this project is to be burned on a CD

so
it
can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent

drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation

and
open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Open files from a dynamic path..

Nick,

thnx!! works great.. you've been a great help!!
--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

Arjan,
OK, this a bit more correct :

Private Declare Function ShellExecute Lib "shell32.dll" Alias
"ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

Private Sub CommandButton1_Click()
ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1
End Sub

NickHK

"Arjan" wrote in message
...
Nick,

Sorry to bother you again..
I tried to insert the code, unfortunalty there's a compile-error which
states that
it expects a rulenumber or a name or a instruction or a instruction-end..

I do have to put the code in the command button sub? Or do I make a

mistake?



--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

If you just want to open them in the user's defualt app for pdf files :

Public Declare Function ShellExecute Lib "shell32.dll" Alias

"ShellExecuteA"
_
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long

ShellExecute 0, "open", Thisworkbook.path & "\YourPDF.pdf", "", "", 1

NickHK

"Arjan" wrote in message
...
Nick,

Thanks for your reply.. The files are in the same path as the

workbook.
However, what I don't know is the how to open the file(s)..

what code do I have to use?

Arjan




--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****


"NickHK" wrote:

Arjan,
Depends where the PDFs are relative to the Excel WB. You already

have
ThisWorkbook.Path, so if they in a sub folder of that :
ThisWorkbook.Path & "\PDF_Folder\PDF1.pdf"

If you maybe on Mac then you would need to do bit work at detecting

that
first.

NickHK

"Arjan" wrote in message
...
Hi al..

I have a problem.. I placed the question here last week aswell,
unfortunatly
it did not solve my problem..

Scope:
I have a userform where I would like to add some buttons wich open
certain
adobe PDF files. Furthermore, this project is to be burned on a CD

so
it
can
be distributed.
My problem are the drive letters.. (diffrent systems, diffrent

drive
letters..)

this is the code i'm using..
_______________

Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
filelocation = ThisWorkbook.Path
_________________

I'm missing the last part where I call the variable filelocation

and
open
the pdf file..
Who can help me out?


--
Arjan Bregman

*****
the knowledge is always there, maybe hidden, but it is there..
*****









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 Dialog Box to return Selected File Path and Not Open it. DMS Excel Programming 4 January 26th 10 12:46 PM
Specify Path / open all files in folder... Buffyslay Excel Programming 1 November 23rd 06 11:17 AM
Dynamic directory path Newbie Excel Discussion (Misc queries) 1 April 24th 06 04:56 PM
setting a dynamic path in an excel query Glen[_5_] Excel Programming 3 February 1st 06 04:35 PM
Making path of linked cell dynamic Negentropy Excel Discussion (Misc queries) 3 September 24th 05 09:02 PM


All times are GMT +1. The time now is 06:32 AM.

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"