Invalid Procedure or argument error.

Hello,

     Im fairly new to the solidworks api so please bare with me. I have managed to write quite a bit of code for a project im working on but Im having a little trouble understanding why i keep recieving this argument error on a certain line of code. I have tried declaring it differently but it did not seem to fix the issue so ill ask the pros. It could be something really simple that i keep overlooking. Any thoughts are appreciated. These are only sections of the code(too long to list all of it) if i have missed any important info let me know.

*** = Line of code that is causing the error

Dim myDimension6 As Object

Dim myDimension7 As Object

Dim myDimension8 As Object

Dim myDimension9 As Object

Dim Trim As String

Dim Trim1 As String

Dim PanL As String

Dim IPS As String

Dim DPS As String

Dim count As String

Dim count1 As Double

'Retrieves the Infeed Sprocket Pitch

Set myDimension6 = Part.Parameter("SprocketPitch@Sketch1@" & Prefix & " INFEED PAN.Part")
Isprkt = myDimension6.SystemValue * Conv
If Isprkt = 0 Then
MsgBox ("Infeed Sprocket Pitch Error")
End If

'Retrieves the Discharge Sprocket Pitch

Set myDimension7 = Part.Parameter("SprocketPitch@Sketch1@" & Prefix & " DISCHARGE PAN.Part")
Dsprkt = myDimension7.SystemValue * Conv
If Dsprkt = 0 Then
MsgBox ("Infeed Sprocket Pitch Error")
End If

'Retrieves the Infeed Intralox A Dimension

Set myDimension8 = Part.Parameter("IntraloxAMin@Sketch1@" & Prefix & " INFEED PAN.Part")
InA = myDimension8.SystemValue * Conv
If InA = 0 Then
MsgBox ("Infeed Intralox A Value Error")
End If

'Retrieves the Discharge Intralox A Dimension

Set myDimension9 = Part.Parameter("IntraloxAMin@Sketch1@" & Prefix & " DISCHARGE PAN.Part")
DisA = myDimension9.SystemValue * Conv
If DisA = 0 Then
MsgBox ("Discharge Intralox A Value Error")
End If

***IPS = (0.3125) + (0.5 * Isprkt) + Sqr((0.5 * Isprkt) ^ 2 - (InA - 1.25) ^ 2) + 2
DPS = (0.3125) + (0.5 * Dsprkt) + Sqr((0.5 * Dsprkt) ^ 2 - (DisA - 1.25) ^ 2) + 2
PanL = Length - IPS - DPS - 108
count = (PanL / 108)
count1 = Int(count)
SolidworksApi macros