PC Review


Reply
Thread Tools Rate Thread

Current file path

 
 
=?Utf-8?B?QXJqYW4=?=
Guest
Posts: n/a
 
      24th Nov 2006
Hi all,

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..)

I have some code, but this is not working properly.. the errormessage is
that it cannot sustain(?) for a read only property.

________________________________________________
Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
ThisWorkbook.Path = filelocation
Sheets("UserSettings").Range("H3").Value = filelocation ' to view the
filelocation
'Shell "GetCurrentPath()V(S)F24-32-45.pdf"
End Sub
____________________________________

Does anyone has a suggestion how to solve this?
Thank you all!


--
Arjan Bregman
the Netherlands

*****
the knowledge is always there, maybe hidden, but it is there..
*****
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      24th Nov 2006
Arjan,
Make it ...

filelocation = ThisWorkbook.Path
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Arjan" <(E-Mail Removed)>
wrote in message
Hi all,
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..)

I have some code, but this is not working properly.. the errormessage is
that it cannot sustain(?) for a read only property.
____________________________________
Private Sub CommandButton19_Click()
'open pdf file
Dim filelocation As String
ThisWorkbook.Path = filelocation
Sheets("UserSettings").Range("H3").Value = filelocation ' to view the
filelocation
'Shell "GetCurrentPath()V(S)F24-32-45.pdf"
End Sub
____________________________________

Does anyone has a suggestion how to solve this?
Thank you all!
--
Arjan Bregman
the Netherlands

*****
the knowledge is always there, maybe hidden, but it is there..
*****
 
Reply With Quote
 
=?Utf-8?B?QXJqYW4=?=
Guest
Posts: n/a
 
      24th Nov 2006
Jim,

thnx.. that works!
For the next step, how can I open the files which are in that path?

Arjan





--
Arjan Bregman

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


"Jim Cone" wrote:

> Arjan,
> Make it ...
>
> filelocation = ThisWorkbook.Path
> --
> Jim Cone
> San Francisco, USA
> http://www.realezsites.com/bus/primitivesoftware
>
>
> "Arjan" <(E-Mail Removed)>
> wrote in message
> Hi all,
> 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..)
>
> I have some code, but this is not working properly.. the errormessage is
> that it cannot sustain(?) for a read only property.
> ____________________________________
> Private Sub CommandButton19_Click()
> 'open pdf file
> Dim filelocation As String
> ThisWorkbook.Path = filelocation
> Sheets("UserSettings").Range("H3").Value = filelocation ' to view the
> filelocation
> 'Shell "GetCurrentPath()V(S)F24-32-45.pdf"
> End Sub
> ____________________________________
>
> Does anyone has a suggestion how to solve this?
> Thank you all!
> --
> Arjan Bregman
> the Netherlands
>
> *****
> the knowledge is always there, maybe hidden, but it is there..
> *****
>

 
Reply With Quote
 
Jim Cone
Guest
Posts: n/a
 
      24th Nov 2006
Code stolen from Rob Bruce...
The API determines the application to use to open the file.
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html


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

Sub OpenFileInDefaultApp(FullName As String)
ShellExecute 0, vbNullString, FullName, 0&, 0&, 1
End Sub

Sub test()
OpenFileInDefaultApp "C:\Documents and Settings\user\My Documents\Statistical flaws in Excel.pdf"
End Sub
'--------------




"Arjan" <(E-Mail Removed)>
wrote in message
Jim,
thnx.. that works!
For the next step, how can I open the files which are in that path?
Arjan
--
Arjan Bregman



"Jim Cone" wrote:
> Arjan,
> Make it ...
>
> filelocation = ThisWorkbook.Path
> --
> Jim Cone
> San Francisco, USA
> http://www.realezsites.com/bus/primitivesoftware


>
>
> "Arjan" <(E-Mail Removed)>
> wrote in message
> Hi all,
> 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..)
>
> I have some code, but this is not working properly.. the errormessage is
> that it cannot sustain(?) for a read only property.
> ____________________________________
> Private Sub CommandButton19_Click()
> 'open pdf file
> Dim filelocation As String
> ThisWorkbook.Path = filelocation
> Sheets("UserSettings").Range("H3").Value = filelocation ' to view the
> filelocation
> 'Shell "GetCurrentPath()V(S)F24-32-45.pdf"
> End Sub
> ____________________________________
>
> Does anyone has a suggestion how to solve this?
> Thank you all!
> --
> Arjan Bregman
> the Netherlands
>
> *****
> the knowledge is always there, maybe hidden, but it is there..
> *****
>

 
Reply With Quote
 
=?Utf-8?B?QXJqYW4=?=
Guest
Posts: n/a
 
      25th Nov 2006
Hi Jim,

What I don't understand is that there still is a hard coded drive letter in
the code from Rob Bruce..

Is it not easier to solve with something like below?
Shell "start.exe filelocation\filename.pdf"

Arjan

--
Arjan Bregman

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


"Jim Cone" wrote:

> Code stolen from Rob Bruce...
> The API determines the application to use to open the file.
> --
> Jim Cone
> San Francisco, USA
> http://www.officeletter.com/blink/specialsort.html
>
>
> 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
>
> Sub OpenFileInDefaultApp(FullName As String)
> ShellExecute 0, vbNullString, FullName, 0&, 0&, 1
> End Sub
>
> Sub test()
> OpenFileInDefaultApp "C:\Documents and Settings\user\My Documents\Statistical flaws in Excel.pdf"
> End Sub
> '--------------
>
>
>
>
> "Arjan" <(E-Mail Removed)>
> wrote in message
> Jim,
> thnx.. that works!
> For the next step, how can I open the files which are in that path?
> Arjan
> --
> Arjan Bregman
>
>
>
> "Jim Cone" wrote:
> > Arjan,
> > Make it ...
> >
> > filelocation = ThisWorkbook.Path
> > --
> > Jim Cone
> > San Francisco, USA
> > http://www.realezsites.com/bus/primitivesoftware

>
> >
> >
> > "Arjan" <(E-Mail Removed)>
> > wrote in message
> > Hi all,
> > 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..)
> >
> > I have some code, but this is not working properly.. the errormessage is
> > that it cannot sustain(?) for a read only property.
> > ____________________________________
> > Private Sub CommandButton19_Click()
> > 'open pdf file
> > Dim filelocation As String
> > ThisWorkbook.Path = filelocation
> > Sheets("UserSettings").Range("H3").Value = filelocation ' to view the
> > filelocation
> > 'Shell "GetCurrentPath()V(S)F24-32-45.pdf"
> > End Sub
> > ____________________________________
> >
> > Does anyone has a suggestion how to solve this?
> > Thank you all!
> > --
> > Arjan Bregman
> > the Netherlands
> >
> > *****
> > the knowledge is always there, maybe hidden, but it is there..
> > *****
> >

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Active or current file path Ted M H Microsoft Excel Programming 9 2nd Oct 2009 09:04 PM
Macro to cause Explorer to open in same file path location that current file is located. cparnell@southernstorefixtures.com Windows XP General 0 11th Jan 2006 10:26 PM
current toolbar file path? =?Utf-8?B?RWxpemFiZXRo?= Microsoft Excel Programming 1 19th Aug 2005 04:19 AM
path to current file... daschund Microsoft Excel Programming 1 31st Aug 2004 11:45 PM
Howto get the current file path with SSI Eranga Udesh Microsoft ASP .NET 1 6th Apr 2004 06:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:48 AM.