PC Review


Reply
Thread Tools Rate Thread

Detect file.

 
 
Heera Chavan
Guest
Posts: n/a
 
      29th Apr 2009
Hi

Below mentioned is my macro.
I want to see an access file is available on a path or not.

Sub team()

Dim mypath As String
Dim Fpath As String
Dim Fname As String

Fpath = ThisWorkbook.Sheets("Team3").Range("A1").Value ' the value is
"C:\Documents and Settings"
Fname = ThisWorkbook.Sheets("Team3").Range("A2").Value ' the value is "Team"

mypath = Fpath & "\" & Fname

If Dir(mypath) = "" Then
MsgBox "Network is disconnect or the required file is not available on
path.", vbInformation
Exit Sub
End If

end sub

 
Reply With Quote
 
 
 
 
FSt1
Guest
Posts: n/a
 
      29th Apr 2009
hi.
what problems are you having? error messages?
i see 1 potential problem with Fname. team? shouldn't that be team.xls

regards
FSt1

"Heera Chavan" wrote:

> Hi
>
> Below mentioned is my macro.
> I want to see an access file is available on a path or not.
>
> Sub team()
>
> Dim mypath As String
> Dim Fpath As String
> Dim Fname As String
>
> Fpath = ThisWorkbook.Sheets("Team3").Range("A1").Value ' the value is
> "C:\Documents and Settings"
> Fname = ThisWorkbook.Sheets("Team3").Range("A2").Value ' the value is "Team"
>
> mypath = Fpath & "\" & Fname
>
> If Dir(mypath) = "" Then
> MsgBox "Network is disconnect or the required file is not available on
> path.", vbInformation
> Exit Sub
> End If
>
> end sub
>

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      30th Apr 2009
The file extension is missing. Try below code.

Sub team()

Dim mypath As String
Dim Fpath As String
Dim Fname As String

Fpath = ThisWorkbook.Sheets("Team3").Range("A1").Value
Fname = ThisWorkbook.Sheets("Team3").Range("A2").Value
mypath = Fpath & "\" & Fname & "<extension>"
If Dir(mypath, vbNormal) = "" Then
MsgBox "Network is disconnect or the required file is not available on
path.", vbInformation
Exit Sub
End If

End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"Heera Chavan" wrote:

> Hi
>
> Below mentioned is my macro.
> I want to see an access file is available on a path or not.
>
> Sub team()
>
> Dim mypath As String
> Dim Fpath As String
> Dim Fname As String
>
> Fpath = ThisWorkbook.Sheets("Team3").Range("A1").Value ' the value is
> "C:\Documents and Settings"
> Fname = ThisWorkbook.Sheets("Team3").Range("A2").Value ' the value is "Team"
>
> mypath = Fpath & "\" & Fname
>
> If Dir(mypath) = "" Then
> MsgBox "Network is disconnect or the required file is not available on
> path.", vbInformation
> Exit Sub
> End If
>
> end sub
>

 
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
Detect file format (version) of Excel file Alan Microsoft Excel Programming 1 28th Oct 2008 07:55 PM
detect if a file is open deerchao Microsoft C# .NET 1 17th Sep 2007 10:25 AM
Please help to detect this file OverAC Microsoft Excel Programming 4 12th May 2006 10:06 AM
how to detect if a file is a valid jpeg file ? THY Microsoft ASP .NET 4 8th Nov 2003 02:44 AM
How to detect changes in a PST file Iwi Microsoft Outlook VBA Programming 2 25th Sep 2003 02:09 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:42 AM.