Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Detect file.

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Detect file.

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Detect file.

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
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
Detect file format (version) of Excel file Alan[_8_] Excel Programming 1 October 28th 08 07:55 PM
Please help to detect this file OverAC[_21_] Excel Programming 4 May 12th 06 10:06 AM
Detect if file exists PeterW[_12_] Excel Programming 5 April 2nd 06 04:13 PM
Detect if a file is in use or being modified shawb[_2_] Excel Programming 3 June 28th 05 01:04 PM
Detect if file is open Chad[_6_] Excel Programming 4 July 9th 03 05:05 AM


All times are GMT +1. The time now is 11:23 AM.

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"