PDA

View Full Version : Solved: Error with Loading Userform.Show



malik641
08-16-2006, 08:57 PM
Hey guys,

This is something I'm really not sure why is happening. I keep getting an "Object variable or With Block variable not set" error with the following code highlighted when I debug:

pdfForm.Show
This only happens when I bring something from work (Excel 2000) home (Excel 2003) and work on my excel file.

I don't know where to start looking, any ideas?

TIA

Ivan F Moala
08-16-2006, 09:02 PM
Step through your Userform code or put Break points in to see where the code bugs out.

malik641
08-16-2006, 09:11 PM
Thanks Ivan, I'll give it a whirl.

BlueCactus
08-18-2006, 07:30 PM
Most likely in Userform_Initialize(). These can be a pain in the ass to find. Strange that it would work on 2000, but not 2003.

malik641
08-18-2006, 08:01 PM
Most likely in Userform_Initialize(). These can be a pain in the ass to find. Strange that it would work on 2000, but not 2003.
You said it. Pain in the ass. Especially cause VBA just highlights the Userform.Show line when you open the form by another module (instead of just testing it from the VBE)....sigh.

And yes you're right...it was in _Initialize()

It ended up being 2 things wrong. First part was when I edited it and forgot a End With statement (i.e. the first error). The second I don't remember entirely what it was...I think it was something like a line of code that you couldn't use in 2000...or SOMETHING like that...Don't know why I'm drawing a blank.

Anyway, it's fixed for now. Thanks for the suggestions guys :thumb

xld
08-19-2006, 01:42 AM
You said it. Pain in the ass. Especially cause VBA just highlights the Userform.Show line when you open the form by another module (instead of just testing it from the VBE)....sigh.

Do you have your VBIDE options set to 'Break in Class Module'

Norie
08-19-2006, 07:38 AM
Do you have your VBIDE options set to 'Break in Class Module'
Or Break on All Errors.:)

Or you can hit F8 when the Show is highlighted to step through the Initialize code.

malik641
08-19-2006, 12:16 PM
:bow: Bob and Norie, thank you both :bow:

That will surely save me time now :thumb

mdmackillop
08-19-2006, 12:23 PM
...and don't forget Compile VBAProject. :friends:

malik641
08-19-2006, 12:40 PM
...and don't forget Compile VBAProject. :friends:
Will do :friends: thanks MD