How to set format "00000" in macro

Hi all,
I want to use formula =text(Data in listbox,“00000000000000000”) in macro but function is not defined. I try to use format(text(MID_CODE),“00000000000000000”) but it’s not work, what should I do.

Here this is my code

MID_CODE = oMID_ListBx.Items(oMID_ListBx.ItemCount - 1)
MID_forSearch = text(MID_CODE,"00000000000000000")

Thank you

I run again and MID_Search = Format(MID_CODE,“0000000000000000”) is work