Hi
I've been hitting my head on this one for a few hours ... I want to check whether a file exists, and once that has been established either save a file into location a or b.
Below is my code (I'm just using message boxes at the moment to ensure it works correctly, rather than saving). However the message boxes that appear aren't correct, and the variations that have been displayed are dependent on whether I place a space in between the quotes on the line that reads 'If MyFile <> "" Then'
I've been renaming the 'c:\connect.txt' file to test for different variations but I haven't had any luck!
Where am I going wrong, I've written other bits and bobs but can't see what I'm doing wrong with this! Any ideas gratefully received?
Tolan
=-=-=-==-=-=-=
Sub CommandButtonClick()
Dim MyFile as String
MyFile = Dir("C:\connect.txt"
If MyFile <> "" Then
MsgBox "File Exists."
Else
MsgBox "No such file"
End Sub
=-=-=--=-=-=-=-=-
I've been hitting my head on this one for a few hours ... I want to check whether a file exists, and once that has been established either save a file into location a or b.
Below is my code (I'm just using message boxes at the moment to ensure it works correctly, rather than saving). However the message boxes that appear aren't correct, and the variations that have been displayed are dependent on whether I place a space in between the quotes on the line that reads 'If MyFile <> "" Then'
I've been renaming the 'c:\connect.txt' file to test for different variations but I haven't had any luck!
Where am I going wrong, I've written other bits and bobs but can't see what I'm doing wrong with this! Any ideas gratefully received?
Tolan
=-=-=-==-=-=-=
Sub CommandButtonClick()
Dim MyFile as String
MyFile = Dir("C:\connect.txt"
If MyFile <> "" Then
MsgBox "File Exists."
Else
MsgBox "No such file"
End Sub
=-=-=--=-=-=-=-=-