Insert Picture on worksheet with VBA

When you insert pictures into your worksheet in Mac Excel with VBA you will notice that the location of the pictures on your Mac can be important because of Apple's sandbox requirements, read more on this page : Problems with Apple’s sandbox requirements

Examples

Basic example that let you browse to the picture and insert it in cel A8, seems to have no problem with Apple's sandbox requirements and is working. Note: GetOpenFileName is not working correct in Mac Office, file filter is not working for example so you can select any file in this example, you will find a custom GetOpenFile function on my site where you set the file type that you can select, you can check that out if you want.


But if we want to use the path from a picture that is in a cell A1 for example : /Users/rondebruin/Desktop/test1.png


You will notice that it is possible that it will display the "cannot be displayed box" instead of the picture, if you insert the picture manual one time the code will work but that is no solution.
errornopicture
To make this work you must use a folder for your pictures that not have a problem with Apple's sandbox requirements, in the article on top of this page you can read how you can create a folder in the correct location or you can use the script on this page to make it for you and also make a shortcut to the folder on your desktop : Setup your Mac for Mac Office

The path not looks like this anymore /Users/rondebruin/Desktop/test1.png

But something like this :

/Users/rondebruin/Library/Group Containers/UBF8T346G9.Office/MacOffice2016Files/test1.png
2/5/23
Web design by Will Woodgate