+ Reply to Thread
Results 1 to 7 of 7

problem with code

  1. #1
    Ana
    Guest

    problem with code

    Hi,

    I have in a code the following sentence:
    set fs=CreateObject("Scripting.filesystemobject") .....

    before it was working fine in my macro but I had a problem with my computer
    and I had to install everything again and now this marcro sotps in this line
    , I think I have to include somthing in the references but I do not know
    what...

    any idea?

    thank you

    ana

  2. #2
    Ivan Raiminius
    Guest

    Re: problem with code

    Hi Ana,

    no, you don't need to set reference with late binding.
    You need to "dim fs as object" first

    Or you can set reference to "Microsoft Scripting Runtime" (early
    binding), and code like this:
    dim fs as scripting.filesystemobject
    set fs=new scripting.filesystemobject

    Regards,
    Ivan


  3. #3
    Ana
    Guest

    Re: problem with code

    if I add
    dim fs as scripting.filesystemobject

    there is an error in this line

    but my macro was working fine last week the same code (it has been working
    fine for almost a year) and now after someone touched my computer we had to
    install everything again that is the only diference...........


    "Ivan Raiminius" wrote:

    > Hi Ana,
    >
    > no, you don't need to set reference with late binding.
    > You need to "dim fs as object" first
    >
    > Or you can set reference to "Microsoft Scripting Runtime" (early
    > binding), and code like this:
    > dim fs as scripting.filesystemobject
    > set fs=new scripting.filesystemobject
    >
    > Regards,
    > Ivan
    >
    >


  4. #4
    Ivan Raiminius
    Guest

    Re: problem with code

    Hi,

    if you add
    dim fs as scripting.filesystemobject
    you should also set the reference to "Microsoft Scripting Runtime".

    When your original code stops, what is the error message?

    Regards,
    Ivan


  5. #5
    Ana
    Guest

    Re: problem with code

    it was that the missing reference to "Microsoft Scripting Runtime".
    thank you

    Ana

    Ivan Raiminius" wrote:

    > Hi,
    >
    > if you add
    > dim fs as scripting.filesystemobject
    > you should also set the reference to "Microsoft Scripting Runtime".
    >
    > When your original code stops, what is the error message?
    >
    > Regards,
    > Ivan
    >
    >


  6. #6
    NickHK
    Guest

    Re: problem with code

    Ana,
    changes are that you do not need the fso at all.
    VBA has built in ways of achieving the majority of its functionality..and
    faster also.

    NickHK

    "Ana" <Ana@discussions.microsoft.com> wrote in message
    news:6CB16339-35AF-4CD0-A58D-2B9AEE70F3CC@microsoft.com...
    > Hi,
    >
    > I have in a code the following sentence:
    > set fs=CreateObject("Scripting.filesystemobject") .....
    >
    > before it was working fine in my macro but I had a problem with my

    computer
    > and I had to install everything again and now this marcro sotps in this

    line
    > , I think I have to include somthing in the references but I do not know
    > what...
    >
    > any idea?
    >
    > thank you
    >
    > ana




  7. #7
    NickHK
    Guest

    Re: problem with code

    That should read "Chances are..."

    NickHK

    "NickHK" <TungCheWah@Invalid.com> wrote in message
    news:OXCbCqeaGHA.3992@TK2MSFTNGP05.phx.gbl...
    > Ana,
    > changes are that you do not need the fso at all.
    > VBA has built in ways of achieving the majority of its functionality..and
    > faster also.
    >
    > NickHK
    >
    > "Ana" <Ana@discussions.microsoft.com> wrote in message
    > news:6CB16339-35AF-4CD0-A58D-2B9AEE70F3CC@microsoft.com...
    > > Hi,
    > >
    > > I have in a code the following sentence:
    > > set fs=CreateObject("Scripting.filesystemobject") .....
    > >
    > > before it was working fine in my macro but I had a problem with my

    > computer
    > > and I had to install everything again and now this marcro sotps in this

    > line
    > > , I think I have to include somthing in the references but I do not

    know
    > > what...
    > >
    > > any idea?
    > >
    > > thank you
    > >
    > > ana

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1