Unrecognized term "Format"

Solved
Magali -  
 Magali -
Hello,

Here is a problem I can't find the cause of:
I have a program that allows me to populate a combo box with the 12 months of the year:

 Dim mois(1 To 12) As String
Dim l As Integer

With Sheets("Calendrier 2 ans")
For l = 1 To 12
mois(l) = Format(DateSerial(1, l, 1), "mmmm")
Me.ComboBox3.AddItem mois(l)
Next l
End With

On my PC it works very well. But on my colleague's PC, the program bugs and does not recognize the term "Format".

Where could this come from?

Thank you in advance for your help

Magali

4 answers

  1. Magali
     
    Here is the error message:

    Compile error in hidden module: Sheet4.
    This error commonly occurs when code is incompatible with the version, platform, or architecture of this application. Click "Help" for information on how to correct this error.

    So how can we modify this line:
     month(l) = Format(DateSerial(1, l, 1), "mmmm")
    to have the months in full letters in the combobox?

    Magali
    0
  2. f894009 Posted messages 17417 Registration date   Status Member Last intervention   1 717
     
    Hello,

    in French and in-line English comment: change the name of the combobox

     Mois_txt = Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
    'Mois_txt = Array("janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre")
    Cmb_Mois.Clear
    Cmb_Mois.List = Mois_txt

    If the Format instruction is not recognized, there will be others. Check in the VBA references of your PC and in the one that's causing issues.
    0
    1. Magali
       
      Thank you for your help!
      0
  3. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
     
    Hello,

    sometimes you have this if a reference is missing.
    In VBA, check in 'tools / references...' if you have one marked [Missing]. Uncheck it (note it down before).

    eric

    --
    By continuously trying, we eventually succeed.
    So the more it fails, the more chances we have that it will work. (the Shadoks)
    In addition to the thank you (yes, it’s done!!!), remember to mark it as resolved. Thank you
    0
    1. Magali
       
      Thank you, Eric. I'll check that.
      0
  4. Magali
     
    Indeed, Eric, I have the reference "Microsoft Office XP Web Components" checked on my PC, and on my colleague's it is noted as MISSING.

    So he unchecked it, but could this cause problems later on? Because I don't know what this reference is for...
    0
    1. eriiic Posted messages 24581 Registration date   Status Contributor Last intervention   7 281
       
      Hello,

      It all depends if you are actually using it in your file; that's something only you know what you've done.
      If yes, there will be a part that won't work. You will either have to change your program not to exploit it, or install this library on all the machines that don't have it (which can sometimes be a hassle).

      eric
      0
    2. Magali
       
      Ok. I tested all the features of the program and it works!
      Thank you for the solution.
      0