6 Replies - 2385 Views - Last Post: 11 July 2010 - 02:30 AM

#1 firebolt   User is offline

  • D.I.C Lover
  • member icon

Reputation: 93
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Check if a File Exists

Posted 24 April 2009 - 11:27 PM

Description: Place in code and start.Searches for a file.
Private Sub Form_Load()

Dim x As String
x = InputBox("Enter File Directory")

If Dir$("x") <> "" Then
MsgBox ("The file exists")

Else
MsgBox ("The file does not exist")

End If

End Sub

Is This A Good Question/Topic? 0
  • +

Replies To: Check if a File Exists

#2 paulmurley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-February 10

Re: Check if a File Exists

Posted 22 February 2010 - 03:56 PM

Why not try Add 'Microsoft scripting Runtime' to Click Project>References then in your code then in your code put Dim fso As New FileSystemObject strDisplay = "The file you want to find" Dim mydir mydir = Dir(strDisplay) If mydir = "" Then strReply = MsgBox(" File missing ") Exit Sub End If also gives you access to loads of other file manipulation options
Was This Post Helpful? 0
  • +
  • -

#3 paulmurley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-February 10

Re: Check if a File Exists

Posted 22 February 2010 - 04:00 PM

Why not try Add 'Microsoft scripting Runtime' to Click Project>References then in your code put
Dim fso As New FileSystemObject 
strDisplay = "The file you want to find" 
Dim mydir mydir = Dir(strDisplay) 
If mydir = "" Then strReply = MsgBox(" File missing ")

It also gives you access to loads of other file manipulation options (2nd try - hope it works)
Was This Post Helpful? 0
  • +
  • -

#4 paulmurley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-February 10

Re: Check if a File Exists

Posted 22 February 2010 - 04:01 PM

sorrry you must know wher to split the code - i hope
Was This Post Helpful? 0
  • +
  • -

#5 paulmurley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-February 10

Re: Check if a File Exists

Posted 22 February 2010 - 04:02 PM

it didn't
Was This Post Helpful? 0
  • +
  • -

#6 paulmurley   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 17-February 10

Re: Check if a File Exists

Posted 22 February 2010 - 04:04 PM

ps by directory i trust you mean directory AND filename
Was This Post Helpful? 0
  • +
  • -

#7 videyanand   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 11-July 10

Re: Check if a File Exists

Posted 11 July 2010 - 02:30 AM

PLESE SEND A COMPLET PROJECT OF HOTEL MANAGEMENT IN VB0.6 SUPPORTS
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1