lin100
asked on
User defined typed not defined
1) Path/File access error (Error 75)
This statement IPsec_Folder = Dir$(Directory_Box) result in a blank even if the directory exist.
2) Compiled error - User defined typed not defined
Dim fso As Scripting.FileSystemObject <-- This is where it complaint
////////////////////////// ////////// ////////// /////
Private Sub Install_Program_Click(Inde x As Integer)
Dim IPsec_Folder As String
Dim Msg, Style, Title, Response, MyString
Msg = "The directory " & Directory_Box & " do not exist. " & _
"Do you want to install the program into this directory?" ' Define message.
Style = vbYesNo + vbInformation + vbDefaultButton2 ' Define buttons.
Title = "MsgBox Install IPsec program." ' Define title.
IPsec_Folder = Dir$(Directory_Box)
If IPsec_Folder = "" Then
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
'MkDir (Directory_Box)
Call Copy_Files_To_The_Hard_Dri ve ' Install the application
End If
Else
'Call Search_If_Files_Exist
'Call Copy_Files_To_The_Hard_Dri ve
End If
End Sub
////////////////////////// ////////// ////////// ////////// ////////// ////////// //
Private Sub Copy_Files_To_The_Hard_Dri ve()
On Error GoTo ErrorHandler
Dim File_String As String
Dim Source_File_Path As String
Dim Destination_File_Path As String
Dim fso As Scripting.FileSystemObject
' Dim fso As Scripting.FileSystemObject
Set fso = New Scripting.FileSystemObject
Source_File_Path = "A:\ipsec_win2K\*.*"
Destination_File_Path = "c:\ipsec100"
' MsgBox "Source_File_Path = " & Source_File_Path
' MsgBox "Destination_File_Path = " & Destination_File_Path
fso.CopyFile Source_File_Path, Destination_File_Path
' fso.CopyFile "C:\test.txt", "\\freedom\public"
MsgBox "All mail files have been backup", , "Back up Outlook files"
ErrorHandler:
Resume Next
End Sub
This statement IPsec_Folder = Dir$(Directory_Box) result in a blank even if the directory exist.
2) Compiled error - User defined typed not defined
Dim fso As Scripting.FileSystemObject
//////////////////////////
Private Sub Install_Program_Click(Inde
Dim IPsec_Folder As String
Dim Msg, Style, Title, Response, MyString
Msg = "The directory " & Directory_Box & " do not exist. " & _
"Do you want to install the program into this directory?" ' Define message.
Style = vbYesNo + vbInformation + vbDefaultButton2 ' Define buttons.
Title = "MsgBox Install IPsec program." ' Define title.
IPsec_Folder = Dir$(Directory_Box)
If IPsec_Folder = "" Then
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
'MkDir (Directory_Box)
Call Copy_Files_To_The_Hard_Dri
End If
Else
'Call Search_If_Files_Exist
'Call Copy_Files_To_The_Hard_Dri
End If
End Sub
//////////////////////////
Private Sub Copy_Files_To_The_Hard_Dri
On Error GoTo ErrorHandler
Dim File_String As String
Dim Source_File_Path As String
Dim Destination_File_Path As String
Dim fso As Scripting.FileSystemObject
' Dim fso As Scripting.FileSystemObject
Set fso = New Scripting.FileSystemObject
Source_File_Path = "A:\ipsec_win2K\*.*"
Destination_File_Path = "c:\ipsec100"
' MsgBox "Source_File_Path = " & Source_File_Path
' MsgBox "Destination_File_Path = " & Destination_File_Path
fso.CopyFile Source_File_Path, Destination_File_Path
' fso.CopyFile "C:\test.txt", "\\freedom\public"
MsgBox "All mail files have been backup", , "Back up Outlook files"
ErrorHandler:
Resume Next
End Sub
ASKER
Hi Arthur_Wood. I did Reference (Project/References) to the Microsoft Scripting Runtime library. There is no longer a compile error, but nothing was copied. Any idea what happened ?
IPsec_Folder = Dir$(Directory_Box)
The IPsec_Folder always result in blank.
IPsec_Folder = Dir$(Directory_Box)
The IPsec_Folder always result in blank.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
AW