Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wdDialogExportAsFixedFormat

Status
Not open for further replies.

SnakeEyes909

IS-IT--Management
Jun 17, 2008
26
US
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.
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
 
it's not elegant but you can use
goto 'label'
in the same way you do with the error handling

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
thanks, but that's just it, regardless of the button in the dialog pushed, it goes to the next line, if i put the goto statment in, it would goto that label if ether button is pushed. is there a way to get the 'Selected' button value? i've tried, and it gives me the same value regardless. (the infoinfo = Selected) statement, i had tried an 'if/than' but the 'Selected' value doesn't change with ether button push. :(
 
I'm not really following what you are doing but I think the problem is that you are Displaying the Dialog - which does that, just display, and does not process it. Try this:
Code:
[blue] With Dialogs(wdDialogExportAsFixedFormat)
  [red].Show[/red]

End With[/blue]

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Thanks Tony,

but i've tried the .show with the same resaults. The .display will let you process the document also, if you push publish it will save a pdf in the folder and name you select.
 
Hi,

couldn't it be:

Code:
n = Dialogs(wdDialogExportAsFixedFormat).Show
Select Case n
  Case 0: ... 'Cancel
  Case -1: ... 'OK
  ...
  Case Else: Msgbox "Funny error occured"
End Select

M.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top