WSHOM

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

WSHOM

Post by D Willett »

Hi

I'm installing a vb program on windows 7 and coming up with an error regarding WSHOM.ocx
It seems this control will not register in 7.

My code uses the FileSystem commands, is there an alternative so i can use the application:

Private Sub Form_Load()
On Error GoTo errHandler
Dim fso As New FileSystemObject

Dim LocFile As String
Dim SerFile As String

LocFile = "C:\Program Files\Estimator Console\Estimator Console.exe"
SerFile = "L:\MMPDF\EC-Update\Estimator Console.exe"

If fso.FileExists("C:\Program Files\Estimator Console\Estimator Console.exe") Then
fso.DeleteFile LocFile
fso.CopyFile SerFile, LocFile
Else
fso.CopyFile SerFile, LocFile
End If

Set fso = Nothing
Shell LocFile, vbNormalFocus
Unload Me

errHandler:
Select Case Err

Case 53
MsgBox "There has been an error launching " & vbCrLf & _
"the Estimator Console " & vbCrLf & _
"please contact Dave Willett for " & vbCrLf & _
"further instructions", vbExclamation, "Launch Error"
Unload Me
Case 70
MsgBox "The Estimator Console Is " & vbCrLf & _
"already running", vbInformation, "Error"
Unload Me
End Select
End Sub
Cheers ...

Dave.

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: WSHOM

Post by rory »

Have you tried the Microsoft Scripting Runtime instead? (or just using the simple Dir etc. commands?)
Regards,
Rory

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: WSHOM

Post by D Willett »

Cheers Rory
I'll look at it tomorrow.
Cheers ...

Dave.

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: WSHOM

Post by D Willett »

Hi Rory

Just got chance to look at the Microsoft Scripting Runtime. I'm already using this in my code:

Dim fso As New FileSystemObject

Perhaps I've missed something or you could enlighten me if there are different versions which just use the sccrun without the wshom ?
Cheers ...

Dave.

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: WSHOM

Post by rory »

You shouldn't need the WSHOM control at all. Just reference the Scripting Runtime.
Regards,
Rory

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: WSHOM

Post by D Willett »

Hmm

I've checked and debugged the process and it seems I get an error 70 permissions.
The code as above just basically copies the server file to the local destination, maybe it wasn't wshom after all.
Obviously Windows 7 permissions need to be set up differently to enable the process to function correctly.

If anyone knows or has seen this before please let me know, other than that I'll need to google for a solution or instructions to get around the permissions.

Regards
Cheers ...

Dave.

User avatar
rory
5StarLounger
Posts: 817
Joined: 24 Jan 2010, 15:56

Re: WSHOM

Post by rory »

I suspect you don't have the right permissions for the code to delete from the Program Files directory. You need to either turn off the UAC, change your permissions to that folder, or put the file somewhere else.
Regards,
Rory

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: WSHOM

Post by D Willett »

Thanks Rory

It seems the UAC settings has sorted the issue out.
I'm not too familiar with Windows 7 settings, but you learn a little every day.

Thanks again..
Cheers ...

Dave.