Hiding External Data window

M

MikeM

Is there a command to hide the external data window ath the beginning of a
macro? I've tried

Application.ActiveWindow.Windows.ItemFromID(visWinIDExternalData).Close

but it doesn't activate until after every other step in the macro runs. I've
tried putting in a time delay after that step, as well as

Application.ScreenUpdating = True

but nothing works.

Hope someone can help.

Mike
 
J

John Goldsmith_Visio_MVP

Hello Mike,

You can toggle the visibility of the Data Window in code using:

Application.DoCmd (2044)

(Note there's no ShapeSheet equivalent.)

However, if you want to ensure that the window is closed irrespective of its
initial state then you can could adapt your code as follows:

Public Sub CloseDataWindow()
Dim wdws As Windows
Set wdws = Application.ActiveWindow.Windows
Dim wdw As Window
For Each wdw In wdws
If wdw.ID = visWinIDExternalData Then
If wdw.WindowState <> VisWindowStates.visWSNone Then
wdw.Close
End If
End If
Next wdw
End Sub

This runs through the windows and only attempts to close it if it isn't
already open.

Hope that helps.

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 

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