3 Replies - 9182 Views - Last Post: 20 September 2010 - 11:23 PM Rate Topic: -----

#1 renmee  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 155
  • Joined: 20-July 09

User-defined type not defined

Posted 20 September 2010 - 05:06 PM

Hi i already have scrrun.dll and registered the usual components needed for file system objects, but unfornutanetely vb still gives me "User-defined type not defined in this line -----> Dim fso As New FileSytemObject.

Im creating a short program to copy all files in a folder and then save it to another location.
is there any other way rather than using filesystemobject? how do i do that?

I changed my computer and im using windows 7. is there something i missed?
Thank you so much in advance!!!!


Private Sub cmdhp_Click()
Dim mystring As String
Dim flext As String
Dim fso As New FileSytemObject, iCtr As Integer, dir As String
Dim ServerPath, fileext As String, Extension, FileName As String
Dim frmstring As String
Dim SQLExec As String

fso.CopyFile "C:\Test1\1.xls", "C:\Test2\file_copy.txt"


Is This A Good Question/Topic? 0
  • +

Replies To: User-defined type not defined

#2 thava  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 180
  • View blog
  • Posts: 1,606
  • Joined: 17-April 07

Re: User-defined type not defined

Posted 20 September 2010 - 06:05 PM

i think you have missing some reference Google for it
Was This Post Helpful? 0
  • +
  • -

#3 chuckjessup  Icon User is offline

  • D.I.C Regular

Reputation: 33
  • View blog
  • Posts: 380
  • Joined: 26-October 09

Re: User-defined type not defined

Posted 20 September 2010 - 11:15 PM

not like it is a big deal, I have found that

    FileCopy app.path & "\file you want copied", path to where you want the copy to go & "\filename"



I know it worked in vista and 7 beta not sure if it would work under the release... haven't tried it...

Hope that helps, a little.

Oh and you shouldnt have to use FileSystemObject, should just go.

Jesse Fender
Was This Post Helpful? 0
  • +
  • -

#4 chuckjessup  Icon User is offline

  • D.I.C Regular

Reputation: 33
  • View blog
  • Posts: 380
  • Joined: 26-October 09

Re: User-defined type not defined

Posted 20 September 2010 - 11:23 PM

View Postrenmee, on 20 September 2010 - 03:06 PM, said:

Hi i already have scrrun.dll and registered the usual components needed for file system objects, but unfornutanetely vb still gives me "User-defined type not defined in this line -----> Dim fso As New FileSytemObject.

Im creating a short program to copy all files in a folder and then save it to another location.
is there any other way rather than using filesystemobject? how do i do that?

I changed my computer and im using windows 7. is there something i missed?
Thank you so much in advance!!!!


Private Sub cmdhp_Click()
Dim mystring As String
Dim flext As String
Dim fso As New FileSytemObject, iCtr As Integer, dir As String
Dim ServerPath, fileext As String, Extension, FileName As String
Dim frmstring As String
Dim SQLExec As String

fso.CopyFile "C:\Test1\1.xls", "C:\Test2\file_copy.txt"


Lastly, I was rereading your question, Try moving your fso declaration into the general... Also FSO has to be set to something... such as when you create a file, as follows:

    If Check1.Value = 1 Or Check3.Value = 1 Then
        Set rp = CreateObject("scripting.filesystemobject") 'see here I had to set the fso as a createobject(...)'
        If rp.FileExists(path5 & "\RPDat.DLL") Then
        Else
            Open path5 & "\RPDat.DLL" For Output As #5
            Print #5, "1"
         Close
         End If
     End If



give it a try, worse thing that will happen is that it wont fix it...

Jesse Fender

This post has been edited by chuckjessup: 20 September 2010 - 11:25 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1