Can't enter break mode at this time and word Crashing

J

Joshua

File:
http://jkfweb.com/files/Travel Request Form(public version).dot

Let me start off by saying this is very strange :)

I have had this form done for about 2 weeks and have just been awaiting
approval, well we tried it today and when we click the button which
initiates a macro called RouteMail it crashs. The code for this button
hasn't changed in two weeks, and I have e-mails which I sent out using
this macro within that time and the code is the exact same. Near the
bottom of this post you'll see the macro RouteMail.

For the heck of it I ran through the macro line by line and after the
line "If response = vbYes Then" it chokes with an error that says "Can't
enter break mode at this time" and has an option of continue or end.

My first assumption at this point was ok there is a problem with the
next line "ActiveDocument.Shapes(1).Delete", so I deleted line and it
still crashes at next line. I then did a msgbox
activedocument.shapes.count and it returned a count of 1, which is
correct because I only have one text box in the document which houses
all 3 of my buttons.

I then went back and tried to run the version I uploaded to my server
and the version that was sent out through e-mail when the macro was
working and got the same error. I checked the references and they are
slightly differen't but it crash's both ways so I'm assuming it doesn't
matter.

I guess I should state that my co-worker who was able to run it fine
before, no gets the same error as me.

Was there a windows update pushed recently that might affect this, or am
I just missing something really obvious.

I've linked the file at the top of post, which is located on my server.
I've cleaned the file out so it doesn't have any logos or any of our
personal e-mails in it. I've also removed the password protection for
forms and for the macro projects so you guys can view the code.

Thanks for any help you can provide!!

Joshua

Sub RouteMail ()
Dim response As Long
If ActiveDocument.FormFields("Traveler").Result <> "" Then
Traveler = ActiveDocument.FormFields("Traveler").Result
Else
Traveler = "Unknown"
End If
date1 = ActiveDocument.FormFields("Date1").Result
response = MsgBox(prompt:="Are you sure you want to e-mail this form to
the Travel Request mailbox with a subject of:" & Chr(13) & Chr(13) &
"Travel Request for " & Traveler & " on " & date1, buttons:=vbYesNo,
Title:="E-mail verification")
If response = vbYes Then
ActiveDocument.Shapes(1).Delete
ActiveDocument.HasRoutingSlip = True
With ActiveDocument.RoutingSlip
.Subject = "Travel Request for " & Traveler & " on " & date1
.AddRecipient "(e-mail address removed)"
.AddRecipient "(e-mail address removed)"
.Delivery = wdAllAtOnce
End With
ActiveDocument.Route
Else
End If
End Sub
 
J

Joshua

I've tried re-creating the text-box with the buttons with no luck.

It seems like it's crashing when trying to add the routing recipients.

Joshua
 
J

Joshua

Figured it out :)

Apparently the line

..AddRecipient Recipient:="(e-mail address removed)"

which worked in last two weeks no longer works and causes a crash, yet
if I use this

..AddRecipient Recipient:="Travel Request"

It works fine and no longer crashs word.

I dont know if our exchange server admins made some changes, but I'll
use the alias from now on to add recipient's.
 
J

Joshua

Ok I thought I had it figured out because it was working, but it has
started crashing again.

For about 2 hours it was working fine for me, and I have around 6
e-mails in my sent items to prove it. During that time the form would
crash when trying to add a recipient on anyone else's machine.

I thought it might be somehow related to the fact that I installed
Infopath 2007 on my machine around 1 week ago, so I went to another
user's machine (a developer) who had office 2007 and it gave a message of:

Run-time error ‘5892’:
Method ‘HasRoutingSlip’ of object ‘_Document’ failed

On Office 2003 machines it's just giving a windows crash error of
"Microsoft Office Word has encountered a problem and needs to close. We
are sorry for the inconvenience."

Why would this code stop working for me yesterday, work for two hours
today, and then stop working again.

Any help at this point would be great ;)

Private Sub CommandButton1_Click()
'Button sends an e-mail to Travel Request and Carrie Morales Mailboxes
'Uses Date field and Traveler field to determine subject of e-mail.

Dim response As Long

Application.ScreenUpdating = False

If ActiveDocument.FormFields("Traveler").Result <> "" Then
Traveler = ActiveDocument.FormFields("Traveler").Result
Else
Traveler = "Unknown"
End If

date1 = ActiveDocument.FormFields("Date1").Result
response = MsgBox(prompt:="Are you sure you want to e-mail this form to
the Travel Request mailbox with a subject of:" & Chr(13) & Chr(13) &
"Travel Request for " & Traveler & " on " & date1, buttons:=vbYesNo,
Title:="E-mail verification")

If response = vbYes Then
ActiveDocument.HasRoutingSlip = True
With ActiveDocument.RoutingSlip
.Subject = "Travel Request for " & Traveler & " on " & date1
.AddRecipient Recipient:="Travel Request"
.AddRecipient Recipient:="Carrie Morales"
.Delivery = wdAllAtOnce
End With
ActiveDocument.Shapes(1).Delete
ActiveDocument.Route
End If

Application.ScreenUpdating = True
End Sub
 
J

Joshua

Am I posting this in the wrong area?

As far as I can see the function addrecipient and routemail are only
present for word vba.
 
J

Joshua

I think it must be something with the document at this point and not the
code.

I just created a brand new document and put a command button in it,
attached the code below to the button and created two form fields named
traveler and date1.

It didn't have any problems, and didn't crash. I guess I'll try to
re-create the whole document from scratch since I haven't gotten any
responses from here.

Joshua
 

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