SnakeEyes909
IS-IT--Management
i have a doc that i am trying to convert to pdf using a button. it works, but i'm trying to get the cancel button int the dialog box to jump to a spot in the code, as it is now, no matter what button you push in the dialog takes you to the next line of code in the VBA. i can not find a way to figure out the value of the dialog button.
the last line is the dialog i'm talking about, it opens fine, but when you select cancel or publish it goes on to the next line: (if publish is pushed, it does publish the doc to a pdf, and you can select location and name.)
if the cancel button is pressed i would like it to goto nosave. any suggestions?
Thanks alot in advance
Code:
Set doc = ThisDocument
On Error GoTo ErrHandler
'Confirm new record.
bytContinue = MsgBox("Do you want to save this record?", vbYesNo, "Save Record")
Debug.Print bytContinue
'Process input values.
If bytContinue = vbYes Then
infoinfo = Selection
With Dialogs(wdDialogExportAsFixedFormat)
.Display
End With
the last line is the dialog i'm talking about, it opens fine, but when you select cancel or publish it goes on to the next line: (if publish is pushed, it does publish the doc to a pdf, and you can select location and name.)
Code:
saved:
MsgBox "You saved " & lngSuccess & " File", vbOKOnly, "Error Added"
Call Module3.clearfields
Else
nosave:
MsgBox "You chose not to save file ", vbOKOnly, "Error Added"
Call Module3.clearfields
End If
Exit Function
ErrHandler:
MsgBox Err.Number & ": " & Err.Description, _
vbOKOnly, "Error"
On Error GoTo 0
On Error Resume Next
End Function
if the cancel button is pressed i would like it to goto nosave. any suggestions?
Thanks alot in advance