Forum Discussion

NotSoFastEddie's avatar
NotSoFastEddie
Brass Contributor
Aug 21, 2024

Cannot assign a macro to a button using simple shape - too complex to be assigned to object - Solved

I have this working in another workbook, in fact I copied that worksheet to this workbook.  Since copying can carry the original workbook in some of the formulas (not all it seems), I right-clicked on my button (rectangle shape) to assign the macro, chose the macro from the list and received an error, 'formula is too complex to be assigned to object'.

 

I passed this issue through ChatGPT and followed its suggestions for error checking.

 

I can run the macro on it's own successfully, just can't assign it to a button or any other of the macros for that matter.  I have rebooted the laptop as well, no difference.  Macros are enabled.

 

The filename for this workbook is: "C:\Users\ed.hickey\OneDrive - xxxxxxxx xxxx\Documents\EdsStuff\xxxxxxxxx-xxxxxxx\xxxxxxx\xxxxx-xxxxxxxOrdering\Spreadsheets\ProductionReady\01)xxxxxxxPredesignedBouquetProductLoadV7_20240719_IDWeddingBaby_33xxxxxxxx.xlsm".  The total length is 220 characters which is under the 260 char max for SharePoint.  I changed the filename to a simple name of testv7.xlsm and it worked.  It seems to be either length or a special character.  My understanding is square brackets can cause this issue.

 

After reducing the length, the issue resolved itself.  By taking one character from the filename, the problem is resolved.

 

These samples is creating a button and assigning it fresh - same result

after selecting the correct macro

and choose OK

 

 

  • NotSoFastEddie 

    Do the folder path or the filename contain [ or ] ? If so, that would cause a conflict with Excel.

    If not: it looks like the filename is very long - see if you can get it to work by shortening the filename and/or its path.

  • NotSoFastEddie 

    Do the folder path or the filename contain [ or ] ? If so, that would cause a conflict with Excel.

    If not: it looks like the filename is very long - see if you can get it to work by shortening the filename and/or its path.

    • NotSoFastEddie's avatar
      NotSoFastEddie
      Brass Contributor

      HansVogelaar you got it Hans.  I renamed to a small filename and the issue was resolved.  By removing just one character out of the filepath/filename, the problem got resolved.

       

      Thanks.

Resources