BeforeDocumentClose-method

T

Torben

Hi NG

I want to make a macro in Visio that saves the document as a html
automatically. So I've made a new macro:
Sub ExportHTML()
Dim pageObj As Visio.Page
Dim filename As String
Set pageObj = ThisDocument.Pages.Item("page-1")
filename = "c:\tmpHTML.html"
pageObj.Export filename
End Sub

But how can I connect it to the close/exit procedure, so that this document
is saved automatically in html ?

Regards

Torben
 
M

Matt

Torben,

Just use the predefined function header.

In visual basic, choose the ThisDocument object from the
project explorer to open the code window and enter this
subroutine.

You can also 'show' the other function headers by using
the combo boxes at the top of the code window. Just make
sure the left combo is set to 'Document' and
not '(Declarations)'. Chooses the function from the right
combo box.

Private Sub Document_BeforeDocumentClose(ByVal doc As
IVDocument)

ExportHTML

End Sub

regards,
Matt
 
A

Andy [MS]

In VBA, you can set up an event handler fro the BeforeDocumentClose event,
and then you should be able to just call your function from that event
handler.
 
D

Daniel Smith

Hi Torben,
Call this Sub routine from the BeforeDocumentClose event.


Private Sub appVisio_BeforeDocumentClose(ByVal doc As
Visio.Document) Handles appVisio.BeforeDocumentClose

End Sub

Although this sounds like a suspiciously easy answer and I fear you've
already tried this.

Dan.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top