Share via


Propiedad Document.Saved (Visio)

Indica si un documento tiene cambios sin guardar. Lectura/escritura.

Sintaxis

expresión. Guardado

Expresión Variable que representa un objeto Document .

Valor devuelto

Booleano

Comentarios

Tome precauciones al establecer la propiedad Saved de un documento en True. Si establece la propiedad Saved en True y un usuario u otro programa realiza cambios en el documento antes de cerrarlo, dichos cambios se perderán; Microsoft Visio no muestra ningún mensaje para indicar que se debe guardar el documento.

Un documento que contiene objetos OLE incrustados o vinculados puede presentarse a sí mismo como no guardado, incluso si su propiedad Saved está establecida en True.

Ejemplo:

Esta macro de Microsoft Visual Basic para Aplicaciones (VBA) muestra cómo utilizar la propiedad Saved para determinar si un documento tiene cambios sin guardar. Además, muestra cómo establecer la propiedad Saved. Antes de ejecutar esta macro, reemplace path por la ubicación en la que desea guardar el dibujo, y cambie filename por el nombre que desea asignar al archivo.

 
Public Sub Saved_Example() 
 
 Dim vsoDocument1 As Visio.Document 
 Dim vsoDocument2 As Visio.Document 
 Dim vsoPage As Visio.Page 
 Dim vsoShape As Visio.Shape 
 
 Set vsoPage = ThisDocument.Pages(1) 
 Set vsoShape = vsoPage.DrawOval(2.5, 7, 3.5, 9) 
 
 'Use the SaveAs method to save the document for the first time. 
 ThisDocument.SaveAs "path\filename .vsd" 
 
 'Use the Saved property to verify that the document was saved. 
 'Saved returns True (-1). 
 Debug.Print ThisDocument.Saved 
 
 'Force a change to the document by adding a shape. 
 Set vsoShape = vsoPage.DrawOval(4, 7, 5, 9) 
 
 'Use the Saved property to verify that the document changed 
 'since the last time is was saved. 
 'Saved returns False (0) 
 Debug.Print ThisDocument.Saved 
 
 'Use the Save method to save any new changes. 
 ThisDocument.Save 
 
 'Use the Saved property again to verify that 
 'the document was saved. Saved returns True (-1). 
 Debug.Print ThisDocument.Saved 
 
 'The Saved property can also be set. For example, change 
 'the document again so that the Saved property becomes False. 
 Set vsoShape = vsoPage.DrawRectangle(1, 1, 7, 7) 
 
 'Set the Saved property to True. 
 'Setting the Saved property to True does not save the document. 
 ThisDocument.Saved = True 
 
 'Close the document and then reopen it. Note that 
 'the rectangle was not saved. 
 Set vsoDocument1 = ThisDocument 
 vsoDocument1.Close 
 Set vsoDocument1 = Documents.Open("path\filename .vsd") 
 
End Sub

Soporte técnico y comentarios

¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.