Visio 2002: Get reference to Excel OLE Object worksheet

C

calvinX

I have been working on this for a while now and would love it if someone
could help me. I am developing a COM add-in for visio using vs.net. I am
going to post my code here:

Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim theObjs As Microsoft.Office.Interop.Visio_OLEObjects
Dim ExcelApp As Microsoft.Office.Interop.Excel.Application

theObjs = doc.Application.ActivePage.OLEObjects
If theObjs.Count > 0 Then
ExcelApp = GetObject(, theObjs(1).ClassID)
End If
Try
xlSheet = ExcelApp.ActiveWorkbook.Worksheets(1)
MsgBox("Got sheet reference")
Catch ex As Exception
MsgBox(ex.Message)
End Try
Exit Sub

Thanks

Calvin X
 

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