« Taming your toolbars | Main | Using the Visio Event Monitor tool »

Saturday, 28 June 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54ede3f24883300e55393dbbb8834

Listed below are links to weblogs that reference Linking Org Chart Images:

Comments

Nasser

Hello John

I'm facing a challenging issue , yet you have give me some clues, I have an Excel sheet that would use to create an org-chat using Visio 2007.
, I have a column with nationally information, the challenge is I need to
have a small flag represent each employee nationally inside his box.
same concept cab used but still I'm not there yet

Appreciate your guidance achieving my goal

John

Hello Nasser,

I think David Parker may have answered your question over here: http://bvisual.spaces.live.com/blog/cns!3350D61BC93733A9!521.entry

Best regards

John

john constable

for some reason I can't download the zip. Is it still available, please?

John Goldsmith

Hello John,

Sorry to hear you're having download problems.

I've just had a quick go and it appears to work ok for me I'm afraid.

Let me know if the problem persists and I'll email you a copy.

Best regards

John

john

tried again tonight and it worked perfectly this time, Jon. I can't believe I've 'written' my first VBA macro too! Thanks so much for this. What a shame visio doesn't do this by default.
A couple of quick questions if I may:
1) does this work with 2007?
2) if I change the orgchart data and import a new updated chart through the wizard, do I have to repeat the whole macro creation process again?

Susan

Would it be possible for you to e-mail the actual VBA code to me? I've been assigned the project of creating a picture org chart, and your solution would help me immensely! Our company firewall does not allow for downloads. Your help would be greatly appreciated!

John Goldsmith

Hello Susan,

Have emailed you just now.

Best regards

John

Eddy

Hello John,

I am facing an issue when I generate organization chart from an existing data file using visio 2003 organization chart wizard.
When I regenerate the chart using the same data file, the department sequence changes. For example, for the first time, it displays Department A, Department B and then Department C, but next time when I regenerate it using the same data file and same settings, it displays Department B, Department A and then Department C.

Do you know how I could keep the sequence unchanged when I use the wizard? if yes, could you please post it here or email to me at xxxxxxxx?

Thanks a lot!

Best Regards,
Eddy

John Goldsmith

Hello Eddy,

I'm afraid I'm not sure off the top of my head but I'll have a think and get back to you (I did get your email address by the way).

In the meantime, have you asked on the Visio newsgroups?

Best regards

John

Kevin Warner

This is beautiful. Thank you.
I have a small problem.
When I am trying to update the photos, I get the following error on the folling vba line:
ActiveWindow.Select shpParent, visDeselectAll + visSelect

err.number = -2032465762
err.Description = Inappropriate target object for this action.

This is from the section that is trying to delete an existing picture.
I have been unable to find any substantial documentation for Visio and so I'm unable to work this out. Do you have any idea what's going on here? I'm using Visio 2007 standard edition.

Thanks for any help,
Kevin Warner

Kevin Warner

I fixed it by adding the following lines:
Application.ActiveWindow.Page = pag
ActiveWindow.DeselectAll
ActiveWindow.Select shpParent, visSelect

Thanks again for this code.
Kevin Warner

Coco

Thank you so very much for this. I have been searching for a solution for days. I an a non-coder (although trying to learn) and I'm having a problem with the VB code when using your example. When I run the macro, the VB code comes up with this line highlighted in yellow:
Public Sub RefreshOrgChartImages()
and in the line below, the word Pages is highlighted
For Each pag In ThisDocument.Pages
plus an error box comes up that says Compile error: Method or data member not found.

John Goldsmith

Hello Kevin,

Thanks for your posts and taking the time to feedback the answer.

You're quite right, the problem is that the ActiveWindow needs to be the page being operated upon and I'm missing that part. This could be an issue for a multi page document or if the code is called when the drawing window is not the ActiveWindow.

I'll correct the code and update the download document.

In the meantime you just need to insert the line:

ActiveWindow.Page = pag

...above this line (which can remain the same):

ActiveWindow.Select shpParent, visDeselectAll + visSelect

Thanks again Kevin for spotting the mistake.

All the best

John

John Goldsmith

Hello Coco,

Sorry to hear you're having problems. Do you want to have a look at my reply to Kevin and see if that helps.

Let me know if that helps or if you need more information.

All the best

John

Coco

That worked! Thanks again. Just one more question. Can you point me to the place in the code that makes George Bush's image larger than the rest? Thanks

Simon Goodier

I've made a similar one; where the shapes are exported from LDAP straight to CSV; with a PHP based URL that extracts the thumbnailPhoto and sticks on a PNG file header as part of the HTTP request...
so visiting the URL: http://somewebserver.blah.com/thumbnailPhoto.php?user=sgoodier
will render a PNG image.

This means, if I escape the HTML hack that microsoft introduced; then it renders just fine :)

anyone wanna see it, just ask.

TJ

John,
This macro and instructions was great. I myself had some problems getting it up and running thus had to take your example and work backwards. I have the macro input pictures. I wonder now though when I have the chart updated and organized as I want can I keep it synched up wit the excel file? Or do I have to use Access with this? I also see when I run the macro a second time (say to update new images) it causes a bug in the program. It resizes the previous images and then stops. Be nice if you can mod the macro to update the images with out adjusting the format or crashing. Thanks for this work you posted ... great stuff.

John Goldsmith

Hello TJ,

Regarding your initial problem, where did you find things were not working (which line and what error)? The code should deal with replacing existing images so I'd be interested to know where this is falling over for you. Also, which version of Visio are you using?

How to keep your Visio document synchronised with your data is one of those 'it depends' questions. How large is the data you're dealing with? How frequently do you want to update? etc. Any data source will work, from Excel to Access through to SQL Server. You just need code to get one to talk the other and decide on a strategy for resolving conflicts - ie do you want to draw from your data source and then edit and push back changes from Visio or just have a single direction data flow.

Finally, just to be sure, did you see the follow up post to this one (http://visualsignals.typepad.co.uk/vislog/2008/06/using-the-visio-event-monitor-tool.html)?

Best regards

John

Dave

Hi There- First of all, thank you so much for this code. It works like a charm. I am having an issue with some of the images cutting off the shape border, however. is there a way to add a margin or some padding between the image and the shape its being inserted into?

thanks much! -dave

Suneel Singhal

can same can be done when connecting with ODBC for oracle.

Andreas

Hi all,
thanks for the greate code. it is really helpful.
Anyway I have troubles with the code. I create an orgchart on 3 pages (always with the head of the departments) and when I try to link the images, I always get the error message "inappropriate target for this action" on line ActiveWindow.Select shpParent, visDeselectAll + visSelect.
I tried to add as mentioned above the additional code but then I get the same error on this line: ActiveWindow.Page = pag
does anyone know this issue and can help me?

Norm Lacroix

Hello John,

A fine gentleman, Scott Helmers shared your blog with me on LinkedIn because I was trying to automate inserting pictres into my Org Chart. Initially I was getting an error "Unexpected End of File" Scott pointed out the a line from you script was in error sImageFileName = shpParent.CellsU("Prop." & CONST_IMGCELL).ResultStr("")
he recommended removing the "Prop." line to sImageFileName = shpParent.CellsU(CONST_IMGCELL).ResultStr("") this worked in that it stopped the error but I am not getting the pictures so there is still something wrong. I am using Visio 2010. any ideas??

Thanks,

Norm

The comments to this entry are closed.

Visio MVP

  • MVP

TWITTER

  • FollowMe

MAIN ARCHIVE PAGE

  • Archive page
Blog powered by Typepad