PDA

View Full Version : [SOLVED:] OLE - Embedded Custom Icon won't stick



BrI
05-06-2017, 08:46 AM
I'm using VBA to embed documents into a worksheet as follows:


ActiveSheet.OLEObjects.Add _
Filename:="C:\Users\T400\Desktop\TEST.pdf", _
Link:=False, _
DisplayAsIcon:=True, _
IconFileName:="C:\Users\T400\Documents\My Custom Icon.ico", _
IconIndex:=0, _
IconLabel:="My Custom Label"



This does embed an object with a custom icon and label as I want, but when the file is saved both the Icon and label revert to the defaults (in this case the Adobe symbol and file name).

This may be a known unresolved issue as I found a case here: stackoverflow.com/questions/33094951/ole-object-attachment-on-excel-worksheet-icon-label-displaying-as-random-alpha

However, wondering if there is a solution, especially as excel has a manual method to embed custom icons via the ribbon (See: datapigtechnologies.com/blog/index.php/changing-the-look-of-embedded-objects/ )

Even when I use the manual process, the icon and label revert to the defaults when saved.

Any ideas on how to resolve?

rlv
05-07-2017, 10:23 AM
FWIW, I do not see this behavior under Excel 2010. Both the icon and the label are preserved when I close, then re-open the workbook.

BrI
05-08-2017, 08:11 AM
I had been testing in XL 2016 and not working so had given up. But just tried in 2010 (where it will actually be used) per your post and it does work there - so thanks!