I am working on a project of a memory card game (where all cards are hidden and you have to find pairs of cards by looking at 2 cards at a time), so I made the code works with letters inside of cells and displaying "[x]" for hidden cards.
Now I am trying to move to images, the problem is : I can't just put the *.jpg in the folders, Images need to be embedded in the excel file, so I created a "Data" sheet with all my images (hidden and unhidden). They are named as follow : "christmashidden", "christmasA", "christmasB" etc..
Now i wan't to have my macro to take these shapes and copy them to another worksheet (the "Plate" worksheet for instance) dynamically. So i'm about to create a function like :
Function PlaceImgInCell(Target As Range, PairID As String, ThemeName As String) As Shape
'This function will be called by the main function to place a specific image in a specific cell
'and return the image shape object if any manipuation is needed afterward
Dim TargetImg As Shape
Dim BaseImg As Shape
Set BaseImg = ThisWorkbook.Worksheets("Data").Shapes(ThemeName & PairID) 'l'image de base, on la duplique pour la placer au bon endroit
BaseImg.Copy
but I think that copying and pasting each relevant shape everytime we need to change from hidden to shown might be long to display and not efficient, but i don't know any other way to do, what are the options at my disposal ? Thanks !