Results 1 to 5 of 5

Thread: expected function or variable

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Location
    Greater Manchester, UK
    Posts
    476

    expected function or variable

    VB Code:
    1. Option Explicit
    2. Dim FSO As New FileSystemObject
    3. Private Sub Form_Load()
    4. Copy = FSO.CopyFolder(App.Path + "\" + "files" + "\", "C:\files", True)

    I am using the code above to copy the folder "files" from the app path to c:\, when i try to run the app a compile error occurs, a msgbox comes up saying
    "compile error expected function or variable"
    then .CopyFolder is highlighted.

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: expected function or variable

    You haven't declared the variable you used "Copy"?

    try:
    VB Code:
    1. call FSO.CopyFolder(App.Path + "\" + "files" + "\", "C:\files", True)
    CS

  3. #3
    Junior Member
    Join Date
    Nov 2006
    Posts
    26

    Re: expected function or variable

    I also get a problem like that but the phrase "FileSystemObject" cannot be recognised. What do I suppose to do ?

  4. #4
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: expected function or variable

    You need to set reference to "Microsoft Scripting Runtime"
    CS

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width