Hi.

Now I'm trying to convert C to vba, in especially the below function witch is coming from C.

char *fmt_hex (long long num, int nbits, char *d);

char *fmt_hex (num, nbits, d)
long long num;
int nbits;
char *d;
{
	sprintf (d, "0x%0*llX", (nbits - 1) / 4 + 1, num);
	return (d);
}
and I've converted as the below, but not sure how to convert the "sprintf" of c function.
can you help me please?

Function fmt_hex(num, nbits, d) As Characters
Dim num As Long
Dim nbits As Integer
Dim d As Characters

    sprintf (d, "0x%0*llX", (nbits - 1) / 4 + 1, num);
   fmt_hex = (d)

End Function