All you can do in VBA, you can do in C# as well (by adopting syntax of course). Means, Visio object model is equally accessible from VBA and C#. As for the code sample, it's not quite clear what you mean by "iterating in sequential order". For example, what would you do if shapes on a diagram form a cycle? It has no begin and no end.. Or a tree?
Although, you can rather easily enumerate all shapes and all connections separately:
using System;
using Visio = Microsoft.Office.Interop.Visio;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var app = new Visio.Application();
var doc = app.Documents.Open(args[0]);
var page = doc.Pages[1];
foreach (Visio.Shape shp in page.Shapes)
Console.WriteLine("shape #{0}: text: '{1}'", shp.ID, shp.Text);
foreach (Visio.Connect conn in page.Connects)
Console.WriteLine("connector: #{0} -> #{1}", conn.FromSheet.ID, conn.ToSheet.ID);
app.Quit();
}
}
}
Take a look at these threads:
C# code to read visio shape's connectivity with other shapes in a flow chart
Traverse through every possible path in a Visio Flow-Chart with C#
Note that to simply write values from shapes to a text file, you can use "Shape Reports" button on "Review" tab. See more about "Shape Reports" in Visio: