Link to home
Start Free TrialLog in
Avatar of paulmcneil
paulmcneilFlag for United States of America

asked on

Does Set fs = Scripting.FileSystemObject work with Vista

I get an error mesage that the object does not exist on a Vista pc when I use:

Set fs = CreateObject("Scripting.FileSystemObject")
If fs.folderexists(rsSpecs!ShortcutPathVista) Then
This works splendidly on XP pcs.
...
Avatar of TakedaT
TakedaT
Flag of United States of America image

im running vista 32 and it works just fine for me
try this
start-->run-->regsvr32 scrrun.dll
then try your script again
Avatar of paulmcneil

ASKER

TakedaT,
Thanks for responding. Would you try this code?
Dim fs As Object
Dim strSource As String
Dim strTarget As String

Set fs = CreateObject("Scripting.FileSystemObject")

If fs.folderExists("C:\users\public") = False Then
  msgbox "C:\users\public exists"
End If
     
If fs.FileExists(SOME PATH AND FILE ON YOUR VISTA PC THAT YOU CAN DELETE) = True Then
  fs.deletefile (SOME PATH AND FILE ON YOUR VISTA PC THAT YOU CAN DELETE)
End If

If fs.FileExists(SOME ShortCut PATH AND FILE ON YOUR VISTA PC THAT YOU CAN DELETE - a .lnk file) = True Then
  fs.deletefile (SOME ShortCut PATH AND FILE ON YOUR VISTA PC THAT YOU CAN DELETE - a .lnk file)
End If

strSource = SOME PATH AND FILE YOU CAN COPY
strTarget = SOME PATH AND FILE YOU CAN COPY TO

fs.CopyFile strSource, strTarget, True
ASKER CERTIFIED SOLUTION
Avatar of TakedaT
TakedaT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I meant in the 7th line, not the 5th line.