Results 1 to 18 of 18

Thread: Visio Table

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780

    Visio Table

    i've tried a search and didn't find any results. i need to know if the following is possible.
    i need to make a table in Visio using VB6. i have looked under "datagrid" and "Table" i can't seem to find what i am looking for. any help on this would be greatly appriciated
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    See I knew there would be another issue. Jk.

    Let me take a look and see what I can come up with. The OLE
    Excel thing didn't work out?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    LOL yeah. any way this is where i am as of now, i can get an excel spreadsheet to open up and put some random numbers in there and then paste them into the Visio document but it doesn't really work how i want it to. i talked to my boss and she said that the table will sometimes have two rows not just one. so i have been looking for a way to make a table in Visio.
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    What is the expected end result? Just a grid with values programmatically
    entered in?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Resolved!
    I figured out how to link an Excel workbook into Visio. If you
    double click on it it will bring up the Excel Workbook. You can
    even have the Excel macros enabled or not. Hope it is how you
    need it to be. Heres my code from all of our posts.




    VB Code:
    1. Option Explicit
    2. 'Add reference to MS Visio xx.x Object Library
    3. Dim vsO As Visio.Application
    4. Dim vsD As Visio.Document
    5. Dim vsP As Visio.Page
    6.  
    7. Dim shp1Obj As Visio.Shape
    8. Dim shpGrid1 As Visio.Shape
    9.  
    10. Private Sub cmdRun_Click()
    11.    
    12.     Set vsO = New Visio.Application
    13.     Set vsD = vsO.Documents.Open("D:\Development\VB_Visio\VB.vst")
    14.     vsO.Visible = True
    15.     Set vsP = vsD.Pages.Item(1)
    16.     Set shp1Obj = vsP.Import("D:\Development\work03.gif")
    17.    
    18.     'Show the grid if its a drawing
    19.     If vsO.Application.ActiveWindow.Type = visDrawing Then
    20.         vsO.Application.ActiveWindow.ShowGrid = True
    21.     Else
    22.         'Tell the user why you're not showing the grid.
    23.         MsgBox "Current window is not a drawing window.", vbOKOnly
    24.     End If
    25.    
    26.     'Stretch image
    27.     shp1Obj.Cells("Width") = 2 'Unit is Inches
    28.     shp1Obj.Cells("Height") = 2.5
    29.    
    30.     'Set coordinates
    31.     shp1Obj.Cells("PinX") = 1
    32.     shp1Obj.Cells("PinY") = 1
    33.    
    34.     'Link Excel workbook
    35.     Set shpGrid1 = vsP.InsertFromFile("D:\Development\VB_Visio\Round Selected Region.xls", visInsertLink)
    36.     shpGrid1.Cells("PinX") = 3
    37.     shpGrid1.Cells("PinY") = 3
    38.  
    39. End Sub
    VB/Outlook Guru!
    Attached Images Attached Images  
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    ok looks good. yesterday i was copying and pasting through code and that wasn't working so well for me. that would mean that the spread sheet is already filled out correct? so if i have to fill the spread sheet out then i could do it through code first then do the
    VB Code:
    1. Set shpGrid1 = vsP.InsertFromFile("D:\Development\VB_Visio\Round Selected Region.xls", visInsertLink)
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    i have a question though, i need to find a way to only select the text that is in the cells. i don't want the empty cells to be added.
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Yes, have the spreadsheet filled out first.

    Well, it looks like Visio takes only the populated cell range and
    displays that. So if there are empty cells then, like in my picture
    attachment earlier, they will be displayed.

    Dont forget that if you double-click on the inserted spreadsheet,
    it will bring up that workbook.

    Another solution would be to draw lines to create your own grid.
    Then drop text in the approximate cell areas. May be hard
    though. It would also have to be grouped so if it is moved by the
    user it will move all the grid and its contents.

    lookup the Page.DrawLine method to draw lines in case you want
    to go that direction.

    I will be out of the office for the most part of the day, client site.
    Should be back after 2 pst.

    Later and good luck.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    right, well as far as the page.drawline wouldn't it be easier to draw the lines in the Visio first then save it so that when the file is opened the lines are already drawn then some how grab the values and put them into the right boxes.(this would be based solely upon position). that is just a thought. 2pm Pst. that would be 6pm my time i think. i'll try and check back around that time.
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    ok here is the thing now. we have decided that i will just build the table via rectangles and fill in the values by drawing a rectangle and making the text for that rectangle be the value of that is supposed to go in there. so my question is now this. i have heard you can name the shapes in visio, so if i name the rectangles that are already there is it possible to access those shapes from VB?

    i just heard about the quake man, how close where you?
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    I am not that close. Its near San Jose and I am in LA. About 400 miles
    apart. It was a 6.0

    Yes, you can name shapes from vb and it would be accessing
    them similar to the ways we have been.

    VB Code:
    1. shp1Obj.Name = "Test"
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    good to hear, never been in a quake but it sounds freaky. been in tornados, blizzards, hail storms, wild fires, and floods never a quake tho.

    if i make a shape in Visio first called "Shape1" could i access that shape from VB somehow? that way i could just access the predefined shapes and then just change the text by
    VB Code:
    1. Shape.Text="Name " & VariableData
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Thanks, I have been in a few 5.5s and 6.0s. Not too fun and over
    quick, but I dont think I would want to be in a tornado. Reports
    say that some people felt it in our area.

    Here is how to loop through the shapes collection for a particular
    page, changing the name and text of each shape. This fits in to
    my procedure from the previous examples.

    VB Code:
    1. Dim i As Integer
    2.    
    3.     For i = 1 To vsP.Shapes.Count
    4.         vsP.Shapes.Item(i).Name = "Test-" & i
    5.         vsP.Shapes.Item(i).Text = "TestText-" & i
    6.     Next
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    yeah i was in a tornado in OK, the sky was orange. and i happened to be in a mini-van at the time.

    this will loop through all of the predrawn shapes.
    VB Code:
    1. Dim i As Integer
    2.    
    3.     For i = 1 To vsP.Shapes.Count
    4.         vsP.Shapes.Item(i).Name = "Test-" & i
    5.         vsP.Shapes.Item(i).Text = "TestText-" & i
    6.     Next
    that will name all the shapes, so wouldn't it grab the pre-drawn lines as well?
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    that did grab all of the shapes. i right clicked on a shape and did the following
    Format > Special... > Name:
    i changed the name from "Sheet22" to "Test 1" is it possible to access "Test 1" by call the shape named "Test 1" some how?
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  16. #16
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Instead of using the ordinal position, use the name in its place.
    VB Code:
    1. vsP.Shapes.Item("Item 1").??? 'What ever property you want to access
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2003
    Location
    Portville NY
    Posts
    780
    many thanx. i believe that i know all that i need to know about this for now. but i'd like to thank you for all the of the help that you have given. if i lived in LA i'd buy you a dinner man. thanx again.
    "...Men will still say THIS was our finest hour"
    If a tree falls in the woods and no one is there to see it, do all the other trees make fun of it?

  18. #18
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    No prob.

    I just got back from a client's site and Im ready to eat a good dinner!

    Later
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width