private void gotoPage( int page)
{
if ( m_visioApp.ActiveDocument.Pages.Count >= page)
{
System.Array names;
m_visioApp.ActiveDocument.Pages.GetNames( out names);
int num = names.GetLowerBound(0) + page;
Visio.Page objPage = m_visioApp.ActiveDocument.Pages.get_ItemU( names.GetValue(num));
axDrawingControl1.Window.Page = objPage;
}
}
Useful snippets http://www.mvps.org/visio/VBA.htm
Docs (local) C:\Program Files\Microsoft Office\Visio11\SDK\Docs
Forum http://www.visimation.com/forums/forum.asp
Microsoft Visio Drawing ControlDrawing Control on your FrameaxDrawingControl1.Window.Application
int x = 0;
foreach ( Visio.Page page in axDrawingControl1.Document.Pages)
{
x++;
if ( x == 1)
{
axDrawingControl1.Window.Page = page;
}
}
private void showShapes()
{
foreach( Visio.Page objPage in m_visioApp.ActiveDocument.Pages)
{
foreach( Visio.Shape objShape in objPage.Shapes)
{
DebugPrintln( "Shape '" + objShape.NameU);
}
// How do shapes ever get into a layer?
foreach( Visio.Layer objLayer in objPage.Layers)
{
foreach( Visio.Shape objShape in objLayer.Page.Shapes)
{
DebugPrintln( "Shape '" + objLayer.NameU + " -> " + objShape.NameU);
}
}
}
}
Info about it at Microsoft http://support.microsoft.com/default.aspx?scid=kb;EN-US;831070
WORKAROUND: To work around this problem, use the SetFocus method to make your Visio Drawing Control active before the DoCmd method in your VBA macro.
| Operation | How to do it |
|---|---|
| Background sheet, changing its size | Change the Page Size: File | Page Setup | Page Size | Custom Size |