I have a Variant parameter passed to a function, and this parameter is essentially an Integer:

```
Function Foo(vNum As Variant) As Long

vNum = 50000

```

When I call this function using:

```
Dim A As Integer
A = 2000
Foo(A)

```

I get an Overflow error (6).

This seems to have something to do with vNum being 'classed' as an integer variant when I pass a number smaller than 32767 (the upper limit of integers), which then causes overflow when attempting to assign a number larger than 32767.

---

My question is, **how do I cast or convert this 'Integer' Variant into one that will accept Longs**?

I tried casting: `vNum = CLng(50000)` and `vNum = CVar(50000)`,

and using dummy variables:

```
Function Foo(vNum As Variant) As Long

Dim vTest As Variant
vTest = 50000
vNum = vTest

```

All of these still generated an Overflow error (6).

Would appreciate any help thanks!