Forum Discussion

kheldar's avatar
kheldar
Iron Contributor
Nov 07, 2021
Solved

Formula is too complex to be assigned to object

Hello,

 

 

I can't run neither assign a macro to the object. I've figured it's because of the long file path. However, the files are on Sharepoint and folders need have long file paths. Is there a workaround to this?

 

Thanks.

  • I found out the solution to this.

    This error can be caused by the name of the folder (or previous folder) where the xls-file is located in...
    When the foldername (or name of a previous folder) contains the character "[" and/or "]", you get this error.
    For example when your xls-file is located in
    "C:\XLS-files\] Test\bladibla.xls" or "C:\] XLS-files\Test\bladibla.xls"),
    you will get the 'Formula is too complex to be assigned to object'-error.

    By the way: Other special characters in foldernames (like "+", "(" and "{") won't cause that problem.

    You like to maintain your foldername?!
    In that case you:
    -> move the xls-file to "C:\" (e.g. "C:\bladibla.xls")
    -> open bladibla.xls
    -> add the macro's to the buttons
    -> save & close the xls-file
    -> move back the xls-file to your desired location (e.g. "C:\] XLS-files\Test\bladibla.xls")

    It works for me... hope it works for you too

4 Replies

  • MarkPahulje's avatar
    MarkPahulje
    Brass Contributor

    kheldar In combination with using DocumentID you can use https://pathtoolongautofixer.blogspot.com/ tool that discovers, reports and auto corrects filenames and paths that are too long to fit under the Window's MAXPATH 260 character limit for SharePoint.

  • kheldar's avatar
    kheldar
    Iron Contributor
    I found out the solution to this.

    This error can be caused by the name of the folder (or previous folder) where the xls-file is located in...
    When the foldername (or name of a previous folder) contains the character "[" and/or "]", you get this error.
    For example when your xls-file is located in
    "C:\XLS-files\] Test\bladibla.xls" or "C:\] XLS-files\Test\bladibla.xls"),
    you will get the 'Formula is too complex to be assigned to object'-error.

    By the way: Other special characters in foldernames (like "+", "(" and "{") won't cause that problem.

    You like to maintain your foldername?!
    In that case you:
    -> move the xls-file to "C:\" (e.g. "C:\bladibla.xls")
    -> open bladibla.xls
    -> add the macro's to the buttons
    -> save & close the xls-file
    -> move back the xls-file to your desired location (e.g. "C:\] XLS-files\Test\bladibla.xls")

    It works for me... hope it works for you too
    • Wendy_W1's avatar
      Wendy_W1
      Copper Contributor

      Thank you so very much for this solution.

      Am doing a Cert IV in Accounting and Bookkeeping and was going around the bend trying to work out the reason I was unable to attach a macros to a form control button.

      You're an absolute boomer and I love you.....😀

    • C_Morrical's avatar
      C_Morrical
      Copper Contributor

      I was getting the message. MS BS.

      I moved it to the downloads folder and now am able to connect a button to Macro. 

      Thanks.

       

      Is this a file path length problem or a write permissions problem. I know you said it was a character in the path but my path does not have that special character that I can tell.

      kheldar 

Resources