Visio Guy

Visio Discussions => Programming & Code => Topic started by: Surrogate on April 12, 2022, 02:49:46 PM

Title: How update embedded tables with code ?
Post by: Surrogate on April 12, 2022, 02:49:46 PM
Hi, folks !

I have a Visio document in which three tables from Excel are embedded with linking.
When I edited the table with both opened application at the same time, everything was fine. In the Visio document, the changes were displayed almost in real time
After editing Excel with Visio closed, the data in the embedded table stopped updating. while I found a way to do this using the Links window.
(http://surrogate-tm.github.io/Links.png)

I dont know how update embedded tables with code ?
Title: Re: How update embedded tables with code ?
Post by: Visisthebest on April 14, 2022, 09:28:56 AM
Very interesting question, hopefully someone knows!
Title: Re: How update embedded tables with code ?
Post by: Surrogate on April 14, 2022, 10:58:58 AM
I find lame solution for this:
1. Search Links tool via Tell me... search pane
2. Add Links tool to Quick Access Toolbar
(https://i.imgur.com/48dfkxk.png)
At my side this item get hotkeys Alt+0D
3. This code run update links with emulate press keys
Sub vvv()
' call Links window with hotkeys Alt+0D
SendKeys "%0D"
'select all links in window
SendKeys "{UP}+{END}"
' Press key Update like as press Enter
SendKeys "~"
' Set focus at button "Close"
SendKeys "{TAB}"
'Press button "Close" like as press Enter
SendKeys "~"
End Sub
Title: Re: How update embedded tables with code ?
Post by: Visisthebest on April 14, 2022, 04:02:27 PM
Never tried using something like SendKeys from a VB.NET VSTO add-in does that work properly as well?
Title: Re: How update embedded tables with code ?
Post by: Surrogate on April 14, 2022, 10:02:01 PM
Quote from: Visisthebest on April 14, 2022, 04:02:27 PM
Never tried using something like SendKeys from a VB.NET VSTO add-in does that work properly as well?
I tried using a VB.NET, but without success... (https://visio.getbb.ru/images/ranks/visio_getbb_ru/huh.gif)
May be this article can helps: Keyboard.SendKeys Method (https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.devices.keyboard.sendkeys?view=windowsdesktop-6.0)
Title: Re: How update embedded tables with code ?
Post by: Visisthebest on April 15, 2022, 04:34:06 PM
Thank you Surrogate!