Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Path not found error

I am hoping that someome here can help me out with a problem I am
having.

We distribute our Excel sheets across the nation via a Lotus Notes
database document. In the Excel sheets, when launched, I have some code
to see if a directory exists on the Workbook_Open and the
Workbook_BeforeClose events:

If Len(Dir("MyPath\MyDB.mdb")) = 0 Then Exit Sub

On my server it works as intended.

When the user at another plant opens the document on a different
server, they get a Path Not Found error. The plants other than out
Corporate facility shouldn't have access to this. Why is this? Is there
a solution?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Path not found error

I like to check this way:

dim testStr as string

teststr = ""
on error resume next
teststr=dir("MyPath\MyDB.mdb")
on error goto 0

if teststr = "" then
'not found
else
'found
end if



EAB1977 wrote:

I am hoping that someome here can help me out with a problem I am
having.

We distribute our Excel sheets across the nation via a Lotus Notes
database document. In the Excel sheets, when launched, I have some code
to see if a directory exists on the Workbook_Open and the
Workbook_BeforeClose events:

If Len(Dir("MyPath\MyDB.mdb")) = 0 Then Exit Sub

On my server it works as intended.

When the user at another plant opens the document on a different
server, they get a Path Not Found error. The plants other than out
Corporate facility shouldn't have access to this. Why is this? Is there
a solution?


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Path not found error

Thanks for the reply, Dave

Could I use this instead?

If Dir(MyPath,vbDirectory) = 0 then Exit Sub

Yours is doing the same thing, correct?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Path not found error

Dir is gonna return a string.

Did you mean:
If Dir(MyPath,vbDirectory) = "" then Exit Sub
or
If len(Dir(MyPath,vbDirectory)) = 0 then Exit Sub

And the only difference I've seen is when the MyPath is completely bad--maybe a
badly formed UNC path--or point to a drive that doesn't exist.

Dim myPath As String

myPath = "x:\"
If Len(Dir(myPath & "MyDB.mdb")) = 0 Then
MsgBox "doesn't exist"
End If

myPath = "\\qwerqwer\qwer\qwer\"
If Len(Dir(myPath & "MyDB.mdb")) = 0 Then
MsgBox "doesn't exist"
End If

myPath = "xss:\"
If Len(Dir(myPath & "MyDB.mdb")) = 0 Then
MsgBox "doesn't exist"
End If

The second and third part blew up with:
Run-time error '52':
Bad file name or number

=======
In your original post, I couldn't tell what MyPath was.


EAB1977 wrote:

Thanks for the reply, Dave

Could I use this instead?

If Dir(MyPath,vbDirectory) = 0 then Exit Sub

Yours is doing the same thing, correct?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Path not found error

I think I got it, Dave.

Since the code was generating a error at the plants, I used this code:

If IsError(Dir("\\files\MyFiles\...")) Then Exit Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Path not found error

Dave,

I tried the above code and it still does not work. Maybe I left out a
bit of info.

When the user at another plant runs the code, they get a Path Not Found
error, 76. The path is actually there, just that their security
permissions limit them to what directoreis they can access.

I thought that this would be simple, but the task has been more or a
headache than anything.

I'll try your code to see if it works (kinda bull-headed), and I'll
report back.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Path not found error

If the user is getting the error when they try to save (not open), then they
could have read access, but not write access.

I would think you could modify your code to just check after the attempted save:

on error resume next
'your code to save
if err.number < 0 then
msgbox something went wrong--file not saved
err.clear
end if
on error goto 0



EAB1977 wrote:

Dave,

I tried the above code and it still does not work. Maybe I left out a
bit of info.

When the user at another plant runs the code, they get a Path Not Found
error, 76. The path is actually there, just that their security
permissions limit them to what directoreis they can access.

I thought that this would be simple, but the task has been more or a
headache than anything.

I'll try your code to see if it works (kinda bull-headed), and I'll
report back.


--

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
Counting instances of found text (Excel error? Or user error?) S Davis Excel Worksheet Functions 5 September 12th 06 04:52 PM
Path/File access error (Error 75) after using Name Statement blayne Excel Programming 0 November 10th 05 12:33 AM
Path Not Found Michael[_22_] Excel Programming 2 November 29th 03 04:21 PM
Path Not Found Error Ric Payne Excel Programming 0 October 29th 03 07:59 AM
Which Path not found? Tod Excel Programming 3 August 2nd 03 02:03 PM


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