Search code examples
excelvbauserformregional-settings

Good VBA script fails to run on other computer


I have a very complex excel macro workbook. The VBA code seems to run pretty well on PC's at my location. As soon as I send it to a German colleague it fails to run in unexpected locations of the code.
The last problem I came across is a Runtime error 5 when the code try to modify the Caption of a UserForm (and some text boxes and cmd buttons as well).
Previously we faced with the same issue with SlicerCache(x).ClearManualFilter but somehow I healed itself...

My first thought was to break up the nest With and see which row causes the fail, but it's immediately the first row. I assume it'll do the same for all rows.
I have checked the windows and office settings:

  • I'm running Win10, English language settings and Hungarian formatting settings. -> Code running well.
  • My local colleagues run the same system with Hungarian language and formatting. -> Code running well.
  • The problematic colleague runs Win10 with German language and formatting settings. -> Code fails to run.
  • We both have the same Reference libraries in VBA editor, none missing. (I assume it's carried by the excel file itself.)
  • I have Microsoft 365 MSO (16.0.13801.21050) 32-bit, he running 16.013801.21004 32-bit. (I suppose the update scheduled by the IT department.) This portion of code months before my latest office update, so I don't think it's a cause.

    The sub called by a CommandButton_Click event, and calls the user form zurueckExport. The form is deisgned so that can called for differnet purposes, so the captions have to be modified according to the needs.

    I have ran out of ideas, don't see what and why cause it. Does anybody could give me some help to deal with this issue? I would be very glad.
Public Sub verExport()
   With zurueckExport
        .Caption = "Version Exportieren zum Creo"
        .Label1.Caption = "Welche Version möchten Sie zum Creo exportieren?"
        .CommandButtonExportieren.Visible = True
        .CommandButtonZurueckladen.Visible = False
        .CommandButtonKennlinie.Visible = False
        .KennlinieFormat.Visible = False
        .Show
   End With
End Sub

Solution

  • The captions were too long, that generated the error message on the other computer.

    Resolution:
    I have added several different labels to the UserForm and modify their visibility instead of overwrite the caption.

    Many thanks for @J0eBl4ck for the idea.