FileSystemObject in Visual Basic

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Carter

    FileSystemObject in Visual Basic

    I'm a newbie to Visual Basic. I have been recently working with text
    files, but for some reason my computer gives me an error: "Compile
    Error: User Defined Type Not Defined". It highlights fso as new
    filesystemobjec t. An example of the code is:

    Private Sub Command1_Click( )
    Dim fso as new filesystmobject , txtfile

    My operating system is Windows XP Home Edition. I already have
    scrrun.dll. I am using Visual Basic 6.0 Standard Edition. Thanks in
    advance.

    James Carter
  • Stephane Richard

    #2
    Re: FileSystemObjec t in Visual Basic

    Hi james,

    You need to reference the FSO from the Project Menu / References menu
    option.

    In that list you'l see either Microsoft File System Object or FSO make suer
    that's checked and try to run your code again.

    --
    Stéphane Richard
    Senior Software and Technology Supervisor

    For all your hosting and related needs
    "James Carter" <uofconn11@yaho o.com> wrote in message
    news:d5e5b2eb.0 308220928.79d03 0c4@posting.goo gle.com...[color=blue]
    > I'm a newbie to Visual Basic. I have been recently working with text
    > files, but for some reason my computer gives me an error: "Compile
    > Error: User Defined Type Not Defined". It highlights fso as new
    > filesystemobjec t. An example of the code is:
    >
    > Private Sub Command1_Click( )
    > Dim fso as new filesystmobject , txtfile
    >
    > My operating system is Windows XP Home Edition. I already have
    > scrrun.dll. I am using Visual Basic 6.0 Standard Edition. Thanks in
    > advance.
    >
    > James Carter[/color]


    Comment

    • Bob Butler

      #3
      Re: FileSystemObjec t in Visual Basic

      "James Carter" <uofconn11@yaho o.com> wrote in message
      news:d5e5b2eb.0 308220928.79d03 0c4@posting.goo gle.com[color=blue]
      > I'm a newbie to Visual Basic. I have been recently working with text
      > files, but for some reason my computer gives me an error: "Compile
      > Error: User Defined Type Not Defined". It highlights fso as new
      > filesystemobjec t. An example of the code is:[/color]

      the FSO is designed for use from VBScript, not VB. There's almost always a
      better way to accomplish things using native VB statements and/or API calls.
      If you are just starting then do yourself a favor and don't get hooked on
      something that can be unreliable due to the existence of multiple,
      not-quite-compatible versions and users who have scripting disabled... if
      you can't find the VB way to do something search http://groups.google.com
      and/or post your questions

      Comment

      Working...