Smart Art Org Chart with picture

User avatar
Stefan_Sand
4StarLounger
Posts: 415
Joined: 29 Mar 2010, 11:50
Location: Vienna, Austria

Smart Art Org Chart with picture

Post by Stefan_Sand »

hello,

i extended the code from post
http://www.eileenslounge.com/viewtopic.php?f=27&t=24130" onclick="window.open(this.href);return false;
a little bit, so it is now possible to insert pictures into the org chart by code. Is there any possible way to insert the picture in another format instead of .bmp - to get a higher resolution into the stoplight display? Now the shapes are stored temporarily as a bmp and are inserted as .bmp.

When i changed all the .bmp points of the code into .emf, nothing happened, it stayed the same....
Does anyone know how to overcome a question like this?
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Smart Art Org Chart with picture

Post by HansV »

Why don't you store the pictures in your preferred format in the same folder as the workbook? You can then use them in lines such as

QChild.Shapes(2).Fill.UserPicture ...

and you won't need to store the pictures in the worksheet and export them.
Best wishes,
Hans

User avatar
Stefan_Sand
4StarLounger
Posts: 415
Joined: 29 Mar 2010, 11:50
Location: Vienna, Austria

Re: Smart Art Org Chart with picture

Post by Stefan_Sand »

ok, but if i change:

QNode.Shapes(2).Fill.UserPicture (GetWinTemp & "\img0.bmp")
Else
QNode.Shapes(2).Fill.UserPicture (GetWinTemp & "\img" & Range("D1").Value & ".bmp")
End If

which file format shall i take then? .emf .wmf or what? and do i have to adress the worksheet Master Data. I am not very good with VBA so i figured out the dialogue from stephen Bullen to insert a picture...

moreover, i wanted to give the file away, so anyone could use it, so i took the file folder temp.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Smart Art Org Chart with picture

Post by HansV »

If you permanently store the pictures in the same folder as the workbook, instead of in the Master Data sheet, you don't need the CreatePics code, nor the code in the CopyImage module. You can simply use

QNode.Shapes(2).Fill.UserPicture ThisWorkbook.Path & "\img0.png"

if you use .png files, or

QNode.Shapes(2).Fill.UserPicture ThisWorkbook.Path & "\img0.emf"

if you use .emf files, etc. The .emf format has the advantage that it is a vector format, so it scales better than pixel formats such as .bmp, .png and .jpg. But for images in an organization chart that may not make much difference.
Best wishes,
Hans

User avatar
Stefan_Sand
4StarLounger
Posts: 415
Joined: 29 Mar 2010, 11:50
Location: Vienna, Austria

Re: Smart Art Org Chart with picture

Post by Stefan_Sand »

ok, i tried, i exchanged, .bmp to .emf, in the code (13 times), but i still inserted the .bmp picture....

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Smart Art Org Chart with picture

Post by HansV »

13 times? That implies that you're still using the CreatePics code. I suggested to stop using that.
Best wishes,
Hans

User avatar
Stefan_Sand
4StarLounger
Posts: 415
Joined: 29 Mar 2010, 11:50
Location: Vienna, Austria

Re: Smart Art Org Chart with picture

Post by Stefan_Sand »

The correct question should have been (on my side) how to do it?

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Smart Art Org Chart with picture

Post by HansV »

Do what?
Best wishes,
Hans

User avatar
Stefan_Sand
4StarLounger
Posts: 415
Joined: 29 Mar 2010, 11:50
Location: Vienna, Austria

Re: Smart Art Org Chart with picture

Post by Stefan_Sand »

to adopt the code that the macro does not store the picture.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Smart Art Org Chart with picture

Post by HansV »

1) Store the pictures that you want to use in the same folder as the workbook, with the appropriate names.
2) Remove the line Call CreatePics from the org macro.
3) Change the extension .bmp to the extension of the files that you stored in step 1) in the org macro and in the AddChildren procedure.
Best wishes,
Hans

User avatar
Stefan_Sand
4StarLounger
Posts: 415
Joined: 29 Mar 2010, 11:50
Location: Vienna, Austria

Re: Smart Art Org Chart with picture

Post by Stefan_Sand »

i think i must store them into the temp folder.

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Smart Art Org Chart with picture

Post by HansV »

If you must do that, change ThisWorkbook.Path back to GetWinTemp.
Best wishes,
Hans