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
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