Visio Guy

Visio Discussions => Programming & Code => Topic started by: pbassett on July 12, 2018, 03:32:33 PM

Title: Org Chart automation
Post by: pbassett on July 12, 2018, 03:32:33 PM
Hi,

Can someone point me to code snippets to build an Org Chart from ODBC data? I can't get the macro recorder doesn't capture the steps, otherwise I wouldn't need to post this request.

I have been tasked with creating approximately 40 Org Charts, with photos, on a weekly basis.
The data is in ODBC and I can easily create Org Charts manually following the wizard, but of course I need to automate this task.

Below are the steps I use. This would be only need to be tweaked for the Manager name as I get deeper into a department, e.g. Nurses with hundreds of staff, so the basic code to do this would be all I need.

•   Open Visio
•   New -> Organization Chart
   I want to create my ...
   Information that's already stored in a file or database
   An ODBC-compliant data source
   EXAADHP -> enter password and connect to database                                   [ODBC data source name]
   H11MYAVATAR.ASH_ORG_CHART                                                                 [table name]
   Name POS_POSITION; Reports to SUPERVISOR_POSITION
   Next ; Back
   Name EMP_NAME; Reports to SUPERVISOR_POSITION
   Displayed field in order
   EMP_NAME
   POS_DESCRIPTION
   POS_POSITION
   POS_PAY_GRADE
   Next; Copy database records to shapes
   Locate the folder (Employee Photos pathname above)
   Match pictures based on EMP_NAME
   I want to specify ...
   Select manager and modify page to set # of levels (generally 1 level)
Title: Re: Org Chart automation
Post by: Croc on July 12, 2018, 03:51:05 PM
Look at these discussions:
https://www.office-forums.com/threads/building-an-orgchart-using-vb.1627058/
http://www.mofeel.net/964-microsoft-public-visio-general/7076.aspx
https://support.office.com/en-us/article/Make-Visio-organization-charts-from-personnel-files-a6ce56cf-1714-45a8-863a-e1a8001a2e5e?CorrelationId=5c6eb855-9ac1-4dd3-a663-940c3d825a2c&ui=en-US&rs=en-US&ad=US&ocmsassetID=HA001077464
Title: Re: Org Chart automation
Post by: wapperdude on July 12, 2018, 04:07:34 PM
...and there's this...https://docs.microsoft.com/en-us/visualstudio/vsto/how-to-programmatically-create-new-visio-documents (https://docs.microsoft.com/en-us/visualstudio/vsto/how-to-programmatically-create-new-visio-documents)

Wapperdude