Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Detect file format (version) of Excel file | Excel Programming | |||
Please help to detect this file | Excel Programming | |||
Detect if file exists | Excel Programming | |||
Detect if a file is in use or being modified | Excel Programming | |||
Detect if file is open | Excel Programming |