Anyone have an idea how to turn layers on or off with C# using the Microsoft.Office.Interop.Visio package?
6/9/2006 12:41:01 PM
here's pieces of some code im working on that would help (though its in vb, you still should get the idea)Dim pageToDrop As Microsoft.Office.Interop.Visio.Page = AxDrawingControl1.Window.Page()Dim layer As Microsoft.Office.Interop.Visio.Layerlayer = pageToDrop.Layers.Item(1)layer.CellsC(Microsoft.Office.Interop.Visio.VisCellIndices.visLayerVisible).FormulaU = "0"alot of times i find it easiest to open up Visio and run a macro to see what code it generates
6/9/2006 1:58:54 PM
Yeah I've got it working in VB... The issue is the Interop, here's what I've got in VB (which it can't be in, I'm using the ActiveX Visio Control, no VBA runtime):''Turn off the layer "Bdr" to remove the borderFor Each layer In Visio.ActivePage.Layers Set layerObjVisCell = layer.CellsC(visLayerVisible) Set layerObjPrintCell = layer.CellsC(visLayerPrint) If (layer.Name = "Bdr") Then layerObjVisCell.Formula = 0 layerObjPrintCell.Formula = 0 Border = True End If Next If Border = False Then MsgBox "Border layer does not exist!" End If
6/14/2006 9:26:12 AM
Anyone know how to run VB macros from C#? I've found an example for everything but Visio in M$Office: here http://support.microsoft.com/?scid=kb;en-us;306683&spid=2530&sid=47But Visio has a different interop than all the other Office applications. I can get Visio to launch from C# and even open the drawing I want, but I am unable to run macros still. Any Suggestions?
6/15/2006 2:36:51 PM