Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Request Library in VBA - Get Run-time error 91 - Object not set

Status
Not open for further replies.

ProfessorT

IS-IT--Management
Nov 13, 2006
2
US
I am trying to retrieve the Logon_User information from the ServerVariable in the Request object. I can do this in ASP without any problems. However, when I attempt this in an Excel macro, I get the run-time error 91 - object not set or with block variable not set. I even created an UDF dll to return the logon user name. Again, this works in ASP but, not in the macro. Can the request.servervariable be used in VBA in an excel macro? Or is it only for use in ASP?

My code looks like this:

Dim objGetName As TestName.GetUserName
Set objGetName = New TestName.GetUserName
myUserName = objGetName.GetLoginName <-- Error Occurs Here
MsgBox (myUserName)

If I use the code below, I also get an error.

Dim objGetName As Object
Set objGetName = CreateObject("TestName.GetUserName")
myUserName = objGetName.GetLoginName <-- Error Occurs Here
MsgBox (myUserName)

Could someone please tell me what is wrong? The syntax is correct as far as I can tell.

Thanks.
 
What is TestName?
What is the Request object you refer to?

Are you trying to get the Windows logon name? If so, you can use ENVIRONS("Username").

Gerry
My paintings and sculpture
 
TestName is an activeX dll I created. The function getloginname returns the logon user from the session variable. The dll correctly functions when used in ASP but, not in the macro. I am trying to retrieve the session user not the windows logon name. I can retrieve the windows logged on user already.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top