AnsweredAssumed Answered

Solidworks API: Integer not an Integer?

Question asked by John Boire on Feb 1, 2018
Latest reply on Feb 1, 2018 by John Boire

So here is something interesting,
I wrote a quick function to split a number up, nothing fancy:


Function GetDocNumbers(ConfigNum As Integer) As Variant()

    If ConfigNum > 48 Then

        GetDocNumbers = Array(0, 0, 0)

    End If

Dim tens, remainder, split, i As Integer

tens = ConfigNum / 10

remainder = ConfigNum Mod 10

    If remainder > 0 Then

        split = remainder / tens

        i = remainder Mod tens

    End If

'Return in an array (Number of Documents, Number of sheets per Document, Leftovers(for uneven numbers)

    If tens = 1 And remainder <= 4 Then

        GetDocNumbers = Array(1, ConfigNum, 0)

    ElseIf tens = 1 And remainder > 4 Then

        GetDocNumbers = Array(2, ConfigNum / 2, i)


        GetDocNumbers = Array(tens, 10 + split, i)

    End If


Debug.Print ("GetDocNumbers Run: Success")

End Function


The function runs, however when I put in 22, expecting to get the result
I get (2.2, 10.909ect, 0)

Any idea why?
Is there another data type I need to use? Do I not know what an integer is?