Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Excel in Visio

Excel in Visio

Excel in Visio

I am designing something that will be using a large amount of data as variables. And based on user selections, it will be drawing pages to their specifications.

 I have decided to do this by using an excel spreadsheet off on its own page to pull data from.

 What I need to know is how can I for example:
 I want to have visio look at page "DATA" and look through the spreadsheet on that page called "BANK" and take cell "A7" and place it in a combo box called cmbCombo1.

 What would that command look like?

 Do I need to do anything else to make that command possible?

RE: Excel in Visio

This is the code I am currently using:

Dim xlSheet As Excel.Worksheet

Set xlSheet = Application.ActiveDocument.Pages.ItemU("DataFile").Shapes("DataBank").Object.Worksheets(1)

Application.ActivePage.Shapes("Title").Text = xlSheet.Cell(A2)

I am getting a "user-defined type not defined" error. This means in other programs that I have not referenced the object i am referring to. That is normally under

Tools --> References in most other programs. I cannot even find a way to reference things in Visio. :(

RE: Excel in Visio

In the VBA code window there should be Tools->References menu item. You could also use late-binding, instead...


    Dim objApplication As Object
    Set objApplication = GetObject(, "Excel.Application")
    If objApplication Is Nothing Then
        Set objApplication = CreateObject("Excel.Application")
    End If
However, why not just use an ADO Recordset? Then, you can use SQL queries to access named ranges or even specific columns. If you Google for "VBA ADO Excel", I'm sure you'll find a good tutorial.

RE: Excel in Visio

I am going to stump you sooner or later, Insider! :)

RE: Excel in Visio

LOL I wouldn't doubt that winky smile. Until recently, I only used Visio for making UML diagrams and never used Excel for anything. Then, my employer asked me to do something similar to what you're doing, so I had to learn how to read and write to Excel from Visio. As a database programmer, I was thrilled to see that I could use ADO to interface with Excel via SQL.

RE: Excel in Visio

Nice. :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close