One problem with identifying objects embedded in a sheet is that the OLEObject is not associated with a specific cell. Scenario: for example, using a macro, an object is embedded in cell P7 (more precisely, the upper-left corner of the object is in cell P7). An unruly user moved the object (top left corner) to cell P6 (by 1-2 pixels at most). Searching the addresses of the "source" cells with the macro, we are not able to check whether the required object has been added to the sheet. We see that it is there, while the macro "does not see".
There are at least two solutions to this problem. Both require giving a proper name to the embedded object.
1 Either the name of the object will contain the address of the cell with which we will bind it. Then, by searching OLE objects, we can see if the object has been associated with a specific cell. Example of the name P7_Object1 or E178_Object2
2. or we give each OLE object a specific (unique) name, e.g. CreditAppForm, AMLForm, VATCert, VATExCert, etc. Then we check that the sheet has all the objects with the required names.
Assuming that the first form of object naming was chosen, the macro to check for the presence of OLE objects could look like this:
You should also add a line of code in the macros that insert an OLE object into the sheet, which will appropriately name each of the inserted objects.
Artik
Bookmarks