ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem with code (https://www.excelbanter.com/excel-programming/359829-problem-code.html)

Ana

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

Ivan Raiminius

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


Ana

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



Ivan Raiminius

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


Ana

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



NickHK

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" wrote in message
...
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




NickHK

problem with code
 
That should read "Chances are..."

NickHK

"NickHK" wrote in message
...
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" wrote in message
...
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







All times are GMT +1. The time now is 10:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com