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

  • Thread starter Thread starter omar.norton
  • Start date Start date
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
 
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.
 
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
 
Back
Top