[HOWTO] Add ListBox to Visio Sheet and access it in Visual Basic

Last week I had to deal with Visual Basic in Microsoft Visio Professional 2016. I wanted to fill a ListBox with items containing data from an Excel file. First I searched for a ListBox shape in the shapes pane of Visio and added a ListBox shape to the sheet.

However I could not access it in Visual Basic code as pointed out in several examples I found in the internet. And also the View Code context menu item was not available…

I first couldn’t figure out, why accessing and filling the ListBox in Visual Basic didn’t work. I almost despaired until I figured out, that the developer tab was not activated. After activating the developer tab I realized, that there is an item to insert different controls (ActiveX controls) including a ListBox control.

From then on, my problems solved themselves. I added the ListBox control to the sheet and in the context menu of the ListBox control the View Code item was available and I also was able to access the ListBox control in Visual Basic code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: