T
Tam
Hi, I keep getting ActiveX can't create object : GetObject when using the
below code. I registered the form as a fully trusted form using regform
utility...but still it gives me an error on GetObject Function. There is a
CreateObject Method also used in the code which doesn't give me any error.
Below is the code ...
Sub XDocument_OnLoad(eventObj)
Set Ref =
XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:Test_Plan/@NT_User_Name")
Ref.text = NTUserName()
End Sub
Public Function NTUserName()
strComputer = "."
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colCSItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
For Each objCSItem In colCSItems
UserName = objCSItem.UserName
Next
Set objWMIService = Nothing
Set colCSItems = Nothing
NTUserName = UserName
End Function
I have been trying to fix this issue for a long time no success.. would
appreciate help in this case.
below code. I registered the form as a fully trusted form using regform
utility...but still it gives me an error on GetObject Function. There is a
CreateObject Method also used in the code which doesn't give me any error.
Below is the code ...
Sub XDocument_OnLoad(eventObj)
Set Ref =
XDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/d:Test_Plan/@NT_User_Name")
Ref.text = NTUserName()
End Sub
Public Function NTUserName()
strComputer = "."
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colCSItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
For Each objCSItem In colCSItems
UserName = objCSItem.UserName
Next
Set objWMIService = Nothing
Set colCSItems = Nothing
NTUserName = UserName
End Function
I have been trying to fix this issue for a long time no success.. would
appreciate help in this case.