I want to programmatically switch between to documents

G

Guest

I am trying to copy some shapes from one open visio document and past the
shapes into another open visio document.

I have successfully copied shaped to the clipboard, then opened a new
document and paste the shaped into the new document. But now I need to copy
the shapes on the active document then switch to another open document and
paste into the new active document.

The ActiveDocument property on the Application object appears to be read
only so I can change the ActiveDocument using that property.

Anyone know how to pro grammatically switch between open documents?

Thanks,
Mike
 
J

JuneTheSecond

In VBA, it seems difficult to me, as code must be written in active document.
But easy is to switch ActiveDocument, if you use visual basic or vb.net.
Or, another idea might be to use custonm tool button that trigers such a
macro.
 
J

JuneTheSecond

I did not catch your question.
To switch document, Window.Activate method might be usefull, for example
Sub test()
MsgBox ActiveDocument.Name
Application.Windows(2).Activate
MsgBox ActiveDocument.Name
ActiveWindow.Select ActivePage.Shapes(1), visSelect
ActiveWindow.Selection.Copy
Application.Windows(1).Activate
ActivePage.Paste
End Sub
 
G

Guest

Thanks JuneTheSecond.

The Windows(x).Activate() method is exactly what I needed...
 

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