(Msg. 1) Posted: Thu Jan 31, 2008 8:26 am
Post subject: Runtime error 5479, Mind Decay Dept Archived from groups: microsoft>public>word>vba>userforms (more info?)
This is the code behind a button on a very ordinary userform:
Private Sub PR_Click()
Dim mydoc As Document
Set mydoc = Documents.Open("F:\Doc1.doc")
End Sub
Why would this code *sometimes* give Runtime Error 5479 and tell me I
"can't close Word" because a dialog box is open? The file Doc1 opens
OK, but this error appears. Stranger still, with about equal frequency,
the error sometimes DOESN'T appear, even though nothing else has changed!
I'm *not* trying to close Word; I just want to open the (small and
ordinary and unchanging) Doc1 file. I notice if I Hide the form first
(Me.Hide), nothing chokes; but I really want the form to stay visible
here. I'm out of practice, but as a hardcore userform geek I'm almost
certain I've written code like that before and never had problems. Am I
already senile?
Word 2003, WinXP. These parallel-universe things really fry me....!
Grateful for any clues.
(Msg. 2) Posted: Mon Feb 04, 2008 6:54 pm
Post subject: Re: Runtime error 5479, Mind Decay Dept [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Hi Mark
Sad to hear about the senility<g>.
I have no idea what the answer to your puzzle is. But if this were mine,
there are three things I'd check:
1. Make sure you're using (eg)
Dim frm as MyForm
set frm = new MyForm
frm.Show
but more importantly, make sure you are doing
Unload frm
set frm = Nothing
I had a case just yesterday of weird form things that were happening
because I wasn't unloading the form. If it doesn't unload, Word seems to
get very confused about which, eg, _Initialize and _Activate code to
run.
2. Turn off any add-ins that might be running and that might be causing
a dialog box to display, or making Word think it should display a dialog
box. Maybe an add-in is trying to open a document invisibly and
triggering the problem.
3. I wonder if this instance of Word has actually saved a Normal.dot
file, and/or whether there's a problem with Normal.dot?
4. Detach Doc1.doc from its template to see if the template might be the
cause of the problem.
5. Sprinkle the code liberally with Do Events (though I am generally of
the view that, unless there's demonstrable need for it, this is akin to
calling on black cats or ensuring the moon is in the right position--but
since this is Word, that might be just what you need!).
Hope this helps. If you find some marvellous solution, let us know!
"Mark Tangard" <mtangard.TakeThisOut@RemoveThisToReplyyyy_speakeasy.net> wrote in
message news:uoaYRYCZIHA.2268@TK2MSFTNGP02.phx.gbl...
> This is the code behind a button on a very ordinary userform:
>
> Private Sub PR_Click()
> Dim mydoc As Document
> Set mydoc = Documents.Open("F:\Doc1.doc")
> End Sub
>
> Why would this code *sometimes* give Runtime Error 5479 and tell me I
> "can't close Word" because a dialog box is open? The file Doc1 opens
> OK, but this error appears. Stranger still, with about equal
> frequency, the error sometimes DOESN'T appear, even though nothing
> else has changed!
>
> I'm *not* trying to close Word; I just want to open the (small and
> ordinary and unchanging) Doc1 file. I notice if I Hide the form first
> (Me.Hide), nothing chokes; but I really want the form to stay visible
> here. I'm out of practice, but as a hardcore userform geek I'm almost
> certain I've written code like that before and never had problems. Am
> I already senile?
>
> Word 2003, WinXP. These parallel-universe things really fry me....!
> Grateful for any clues.
>
> Mark
(Msg. 3) Posted: Wed Feb 13, 2008 3:38 pm
Post subject: Re: Runtime error 5479, Mind Decay Dept [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
> the view that, unless there's demonstrable need for it, this is akin to
> calling on black cats or ensuring the moon is in the right position--but
> since this is Word, that might be just what you need!).
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum