Object Variable not set

All, I am trying to open a file on a form from a button. The file name is held in the field FileLoc.

I have this code that worked once, then has been giving me the Object Variable Not Set. I know that this means I have not set something, but for the life of me I can’t see it.

Dim db As NotesDatabase

Dim result As Integer

Dim hi As Variant

Dim uidoc As NotesDocument



Set  hi = uidoc.FieldGetText("FileLoc")



result = Shell("hi", 1) 

Any help would be most appreciated.

TIA

Teri

Subject: Object Variable not set

Turn your debugger on…

Subject: Object Variable not set

‘hi’ should be hi, it’a variable.

Shawn

Subject: Object Variable not set

I am assuming that what code you have written is full. If yes then you need to define what exactly is “uidoc”.

Dim ws as new NotesUIWorkspace

Dim uidoc as NotesUIDocument

set uidoc = ws.currentdocument

then rest of the code follows.

But as suggested, always turn on the Debugger if you are running Lotus Script code. This will help you a lot.

–Phani

Subject: RE: Object Variable not set

Shawn, Phani, and File Save,

Thanks for your responses. I will try them today. As for the dubugger, I had turned it on and tried the code a half dozen times, only to get a pop up box with “Object Variable not set” and nothing apparently happening with the code. I had expected to step through the code so it could point out the errors of my ways.

Teri

Subject: RE: Object Variable not set

It was pointing out the errors of your ways. The line that threw that error had an instance of something that was not initialized. If you step through it and it throws the error on something like:

set strVariable = NotesDocument.Filename(0)

Then it could be that the NotesDocument is not initialized to anything. Look at the Variable tab and see which variables have nothing to the right of them.

As the variables get initialized the variable contents is displayed to the right.

hth,

Shawn