Solved

User defined typed not defined

Posted on 2003-11-10
3
342 Views
Last Modified: 2010-05-01
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(Index 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_Drive             ' Install the application
    End If
  Else
    'Call Search_If_Files_Exist
    'Call Copy_Files_To_The_Hard_Drive
  End If
End Sub

//////////////////////////////////////////////////////////////////////////////

Private Sub Copy_Files_To_The_Hard_Drive()
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
0
Comment
Question by:lin100
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9717265
make sure that you have included a Reference (Project/References) to the Microsoft Scripting Runtime library.  That is where the FileSystemObject is defined.

AW
0
 

Author Comment

by:lin100
ID: 9718174
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.
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 50 total points
ID: 9718634
what is IPsec_Folder ( is it a control or a variable?) and what is the contents of the variable Directory_Box when this code executes?

Put a Break point on the line

 IPsec_Folder = Dir$(Directory_Box)

and examine the variables involved.

AW
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question