SmartArt from VBA code (1 Viewer)

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 07:47
Joined
Feb 28, 2001
Messages
27,001
Just a little discovery that might be of limited interest to folks who like pretty pictures and diagrams created via VBA and automation. Excel has this feature called "SmartArt" which allows you to draw all sorts of strange and wonderful things. I'm using it for drawing family trees, or at least trying to do so.

Here's what I discovered. You cannot use SmartArt in "pure" Access because it is a "Shape" sort of thing and you have one hellacious time adding shapes to either forms or reports. I know, I've tried, and it ain't worth the effort. But if you have no qualms about opening an Excel Application object, you can build a SmartArt object on a spreadsheet. You get all sorts of shapes in several categories including org charts, hierarchies, lists, and other interesting layouts - over 130 in total.

It is further interesting to note that you cannot even refer to a SmartArt object in the context of Access objects. SmartArt infrastructure elements are ONLY visible in Word, Excel, and PowerPoint (that I can find so far). But if you were so inclined, you could put up SmartArt objects from Access VBA in the context of, say, an Excel Application object. I.e. build a spreadsheet from Access control and work inside the spreadsheet.

It is certainly not worse than a graph object - though you CAN put graph objects in Access forms/reports but you can't do so with SmartArt. Or at least that is the way it looks so far, subject to updates if I find out I was wrong about that exclusivity.

Once I get more experience with SmartArt I might be able to explain it better. But in order to get something on record about what can be done in Access and what is difficult and what just won't work, I thought I'd post this.

For anyone who wants to learn about MANUALLY doing SmartArt, the first article is an overview of manually using this feature from Excel. The second is a discussion of a structure called a SmartArt "node" (translation: A text box or other shape that is part of a more complex diagram). It has sufficient links to let you browse around and see what it is all about.

https://support.office.com/en-us/ar...graphics-6ea4fdb0-aa40-4fa9-9348-662d8af6ca2c

https://msdn.microsoft.com/en-us/vba/office-shared-vba/articles/smartartnode-members-office
 

Users who are viewing this thread

Top Bottom