I help support an application that was written in Visual Basic 6 (sp6) some years ago and was recently installed on a Windows 2003 SP2 machine for use under Citrix and am for the first time am getting a “Run Time Error 70 Permission Denied” when the application executes.
After searching of the code I found the error is being generated by the GetObject call that is used to create an interface (reference) to Web Logic that in the past has never been an issue on our old NT servers. ( I know I know, nothing like being on the bleeding edge).
I’ve created a simple piece of code (see below) that will execute as in create a generic “object” on my machine (XP SP2), our old NT servers (no idea of the service pack level) and even Server 2003 with no service pack installed but will fail and error out on the Windows 2003 SP2 Machine, won’t even show up in any of the event logs which are supposed to be cranked up to capture everything.
I’m sure this is a security issue MS introduced with a service pack but every resolution I’ve found on the many many fourms and web sites I’ve researched have been for IIS, MTS or just plain old VBS which doesn’t seem to fit when used in a VB executable.
If anyone has any ideas to why the VBA GetObject function call fails under service pack 2 I would be extremely grateful.
Code Snippet…………………………………………………..
Private Sub Command2_Click()
Dim MyObject As Object
Dim sMonikerAddr As String
Dim sObjectString As String
On Error GoTo err1
' Hard code WebLogic Service Moniker (class), Seems to be constant value on any client machine
sMonikerAddr = "objref:TUVPVwEAAAAABAIAAAAAAMAAAAAAAABGABAAAAAAAABKaW50ZWdyYVRhbGtUb01lV2hhdHNBbGxUaGlzVGhlbhgAEQAHAEQARQBOAEoAVwBMAFEAMQBbADcAMwAxADEAXQAAAAAACgD//wAAAAAAAAAAAAA=:"
'This will fail on W2K3 machine with SP2 installed.
Set MyObject = GetObject(sMonikerAddr)
sObjectString = MyObject
MsgBox "Object created: " & sObjectString
Set MyObject = Nothing
Exit Sub
err1:
MsgBox "Creation failed: Error " & Err.Number & " - " & Err.Description
Set MyObject = Nothing
End Sub
After searching of the code I found the error is being generated by the GetObject call that is used to create an interface (reference) to Web Logic that in the past has never been an issue on our old NT servers. ( I know I know, nothing like being on the bleeding edge).
I’ve created a simple piece of code (see below) that will execute as in create a generic “object” on my machine (XP SP2), our old NT servers (no idea of the service pack level) and even Server 2003 with no service pack installed but will fail and error out on the Windows 2003 SP2 Machine, won’t even show up in any of the event logs which are supposed to be cranked up to capture everything.
I’m sure this is a security issue MS introduced with a service pack but every resolution I’ve found on the many many fourms and web sites I’ve researched have been for IIS, MTS or just plain old VBS which doesn’t seem to fit when used in a VB executable.
If anyone has any ideas to why the VBA GetObject function call fails under service pack 2 I would be extremely grateful.
Code Snippet…………………………………………………..
Private Sub Command2_Click()
Dim MyObject As Object
Dim sMonikerAddr As String
Dim sObjectString As String
On Error GoTo err1
' Hard code WebLogic Service Moniker (class), Seems to be constant value on any client machine
sMonikerAddr = "objref:TUVPVwEAAAAABAIAAAAAAMAAAAAAAABGABAAAAAAAABKaW50ZWdyYVRhbGtUb01lV2hhdHNBbGxUaGlzVGhlbhgAEQAHAEQARQBOAEoAVwBMAFEAMQBbADcAMwAxADEAXQAAAAAACgD//wAAAAAAAAAAAAA=:"
'This will fail on W2K3 machine with SP2 installed.
Set MyObject = GetObject(sMonikerAddr)
sObjectString = MyObject
MsgBox "Object created: " & sObjectString
Set MyObject = Nothing
Exit Sub
err1:
MsgBox "Creation failed: Error " & Err.Number & " - " & Err.Description
Set MyObject = Nothing
End Sub