Home All Groups Group Topic Archive Search About

"ActiveX Control Cannot Create Objects?"

Author
19 Oct 2005 12:47 AM
Charles Krug
List:

I have code that uses the vbScripting Runtime.  *pause for catcalls*

Be that as it may, and I doubt if it is . . .

I have code in a module that's been pretty much Working for over a year
now.

But today, when I try to run the code:

    dim fso as new FileSystemObject

    if not fso.FolderExists(targetFolder) then doStuff

I get "ActiveX Control cannot create objects"

I've verified that the target folder is correct, exists, can be opened,
can be written to and read from and all that good stuff.

I also verified that MSScripting is in the References list.

What other things should I check?

Thanx


Charles

Author
19 Oct 2005 2:16 AM
Ken Halter
Show quote Hide quote
"Charles Krug" <cdk***@worldnet.att.net> wrote in message
news:IIg5f.155392$qY1.110323@bgtnsc04-news.ops.worldnet.att.net...
> List:
>
> I have code that uses the vbScripting Runtime.  *pause for catcalls*
>
> Be that as it may, and I doubt if it is . . .
>
> I have code in a module that's been pretty much Working for over a year
> now.
>
> But today, when I try to run the code:
>
>    dim fso as new FileSystemObject
>
>    if not fso.FolderExists(targetFolder) then doStuff
>
> I get "ActiveX Control cannot create objects"
>
> I've verified that the target folder is correct, exists, can be opened,
> can be written to and read from and all that good stuff.
>
> I also verified that MSScripting is in the References list.
>
> What other things should I check?
>
> Thanx
>
>
> Charles

What type of variable is targetFolder? Do you have Automatic Updates enabled
for Windows? Maybe someone/something changed the permissions for scripting?

You can get the same results with this code....


if not FolderExists(targetFolder) then doStuff

Here's the FolderExists function
'==========
Private Function FolderExists(PathName As String) As Boolean
   On Error Resume Next
   If Len(PathName) > 0 Then
      FolderExists = ((GetAttr(PathName) And vbDirectory) > 0)
      Err.Clear
   End If
End Function
'==========

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
Author
19 Oct 2005 1:40 PM
Charles Krug
On Tue, 18 Oct 2005 19:16:26 -0700, Ken Halter
<Ken_Halter@Use_Sparingly_Hotmail.com> wrote:
> "Charles Krug" <cdk***@worldnet.att.net> wrote in message
> news:IIg5f.155392$qY1.110323@bgtnsc04-news.ops.worldnet.att.net...

>>    dim fso as new FileSystemObject
>>
>>    if not fso.FolderExists(targetFolder) then doStuff
>>
>> I get "ActiveX Control cannot create objects"
>>
>
> What type of variable is targetFolder? Do you have Automatic Updates enabled
> for Windows? Maybe someone/something changed the permissions for scripting?

targetFolder is a string.  "No" for automatic updates.

How do I check scripting permissions?

>
> You can get the same results with this code....
>

Thanks.  I'll need to implement a subset of FileSystemObject, which I'm
trying to avoid, as this project is supposedly "winding down" and I
don't wanna leave TOO much to my successors . . .