Error handler for runtime error 92 "invalid use of null" not working

O

omar.norton

Hi,

I'm using a slightly modified form of the code found on
http://support.microsoft.com/kb/210271 to create a letter based on a
template with the name and address of the record you're viewing added
into it.

All I've changed from the code on the above website is the names of
some of the bookmarks/controls and I've got rid of the code for
copying a photograph as I don't need it.

You can see that the code works by copying the text from your control
and pasting it over one of the bookmarks in your word document. If the
control is empty then you would get a runtime error 92 "invalid use of
null" as you are trying to make a character string from a null - but
those thoughtful people at microsoft have put in an error handler at
the bottom for just this error, so that if this happens the empty
control will be replaced with a zero-length string and the code will
move on to the next bookmark.

But my problem is - runtime error 92 occurs anyway when an empty
control is used, as if the error handler doesn't exist!

Does anyone have any ideas?

Thanks in advance
 
O

omar.norton

Its OK - i've figured it out. For some reason above my head you can't
set a control value in the On Open event - use the On Load event and
it works fine though.
 
O

omar.norton

Hello everyone,

sorry to keep bumping this topic, but I accidentally put that last
post in the wrong forum - I was also trying to solve another problem
at the same time and figured it out, but this one still remains. If
anyone has any ideas I would much appreciate it.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top