Results 1 to 5 of 5
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Forms 'deleted' (WinXP/Word2003)

    I've got another weird one here - perhaps someone has come across it and knows how to persuade Word that it's wrong!!

    I've a template set up (not by me) with a dozen or so userforms, labeled frm1, frm2, etc. I had to make a small change to one (add another field, with the associated code to use the result, and the text in the document) and that's ALL I did.

    However, when I saved and closed it and ran the result, it came up with a runtime error: "5825: Object has been deleted", and clicking on debug highlighted the line "frm123.Show" in the code.

    Needless to say, the form has NOT been deleted, it was clearly visible in the list - so what the heck is Word on about?!

    <img src=/S/confused3.gif border=0 alt=confused3 width=45 height=45> <img src=/S/igiveup.gif border=0 alt=igiveup width=31 height=23>
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Forms 'deleted' (WinXP/Word2003)

    Sometimes VBA gets confused. You could try deleting the line

    frm123.Show

    then typing it in again. I know it seems strange, but sometimes this helps getting rid of invisible garbage.

    You can also download, install and run the free Word Code Cleaner add-in from Combatting Template Bloat.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Forms 'deleted' (WinXP/Word2003)

    Tried it - no go, I'm afraid! However, I have tracked it down a bit closer - it's not actually saying the form has been deleted, but a document variable that's referred to in the code under userform_initialise (for some reason the debug line stopped on the frm123.show line, heavens knows why!).

    I don't have any graphics software to play with a screenshot here at the moment, but I've sent to myself at home and I'll post it as soon as I've had a chance to crop it a bit.

    I can't download, install or run any unauthorised software here, unfortunately! However, maybe the situation will be a bit clearer once I have had a chance to post the screenshot this evening. I hope so!

    Thanks anyway!
    Beryl M


  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms 'deleted' (WinXP/Word2003)

    I'd export all forms (and modules/class modules too) to text files, open a fresh doc and import the exported files into that.

    As to the error on the .Show: if you have an error handler in the routine with the .Show and no error handler in the form code, any error in the form code will throw you back to the line that first calls the userform. Userform.Show in effect loads the userform into memory and fires the initialise event.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Forms 'deleted' (WinXP/Word2003)

    Hi Jan, thanks for that, and yes, I had worked out that when it said the problem was in the .show line that wasn't true - however, I'm afraid the error was actually a PEBKAC one ('problem exists between keyboard and chair' ...), because I have renamed a variable and changed the wrong line in the code, making the entire thing fall over. Heaven knows why I couldn't spot it for so long!

    Sorry for wasting your time, folks, and thanks for your help anyway.
    <img src=/S/sorry.gif border=0 alt=sorry width=15 height=15>
    Beryl M


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •