News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Prompt message before saving a Visio file

Started by Crazy Squirrel, May 24, 2022, 04:50:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Crazy Squirrel

Is there a way to prompt a user with a message (pop up) when they select the save or save as option?

Paul Herber

If the event can be caught using VBA then yes, but the document will have to be saved with the macro-friendly file extension: .vsdm. And macros would have to be enabled at the user-end as well, not something you can control. However, if the file was saved with the non-macro-friendly extension: .vsdx the all the code will be lost and the prompt will never occur.
There are events for:
Document.BeforeDocumentSave
Document.BeforeDocumentSaveAs
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Crazy Squirrel

Thanks Paul.  I have macros in the document already and when the user opens it, they click on a message to enable content.  Would you happen to have the VBA code? I found this to use as a basic start -
Private Sub Form_BeforeUpdate(Cancel As Integer)
   Dim strMsg As String
   Dim iResponse As Integer

   ' Specify the message to display.
   strMsg = "Do you wish to save the change?" & Chr(10)
   strMsg = strMsg & "Click Yes to Save or No to Discard changes."

   ' Display the message box.
   iResponse = MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?")
   
   ' Check the user's response.
   If iResponse = vbNo Then
   
      ' Undo the change.
      DoCmd.RunCommand acCmdUndo

      ' Cancel the update.
      Cancel = True
   End If
End Sub

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 171 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1057KB.
Tokens: post-login.
Cache hits: 13: 0.00155s for 26,741 bytes (show)
Cache misses: 3: (show)
Queries used: 16.

[Show Queries]