RunMacro2 errors when running macro.

So, i have a macro with a userform, that I am trying to program so that I can select which macro of a couple different macro's I wan't to run on a particular part.

The Userform is programmed as such:

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim runMacroError As Long

Dim boolstatus As Long

Dim MacroPath As String

Private Sub CommandButton1_Click()

MacroPath = "c:\test\test.swp"

boolstatus = swApp.RunMacro2("C:\test\test.swp", "test1", "sl", swRunMacroOption_e.swRunMacroUnloadAfterRun, runMacroError)

End Sub

Private Sub CommandButton2_Click()

MacroPath = "c:\test\test.swp"

boolstatus = swApp.RunMacro2("C:\test\test.swp", "test1", "tk", swRunMacroOption_e.swRunMacroUnloadAfterRun, runMacroError)

End Sub

You click on one button and it runs CommandButton1_Click, and the other runs CommandButton2_Click

The c:\test\test.swp is written as follows:

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim swmodel As SldWorks.ModelDoc2

Dim fn As Variant

Dim fn2 As String

Dim DIR As String

Sub sl()

Set swApp = Application.SldWorks

Set swmodel = swApp.ActiveDoc

'' Get the Filename, keep everything before the first space from the left, then convert dots to underscores.

fn = swmodel.GetTitle

fn = Split(fn, " ")

fn2 = Replace(fn(0), ".", "_")

'' Set the save directory

DIR = "\\SL\Solid Works\LASER TUBE\SL\SL LSR PART & IGES"

' SHOW MODEL IN ISO - ZOOM TO FIT

swmodel.ShowNamedView2 "*Isometric", -1

swmodel.ViewZoomtofit2

'SAVE COPY OF MODEL IN SW FORMAT AND IGS FORMT TO DIRECTORY PATH DEFINED ABOVE.

swmodel.SaveAs DIR & "\" & fn2 & ".sldprt"

swmodel.SaveAs DIR & "\" & fn2 & ".igs"

swApp.QuitDoc fn2 & ".sldprt"

End Sub

Sub tk()

Set swApp = Application.SldWorks

Set swmodel = swApp.ActiveDoc

'' Get the Filename, keep everything before the first space from the left, then convert dots to underscores.

fn = swmodel.GetTitle

fn = Split(fn, " ")

fn2 = Replace(fn(0), ".", "_")

'' Set the save directory

DIR = "\\SL\Solid Works\LASER TUBE\T-K\TK LSR PART & IGES"

' SHOW MODEL IN ISO - ZOOM TO FIT

swmodel.ShowNamedView2 "*Isometric", -1

swmodel.ViewZoomtofit2

'SAVE COPY OF MODEL IN SW FORMAT AND IGS FORMT TO DIRECTORY PATH DEFINED ABOVE.

swmodel.SaveAs DIR & "\" & fn2 & ".sldprt"

swmodel.SaveAs DIR & "\" & fn2 & ".igs"

swApp.QuitDoc fn2 & ".sldprt"

End Sub

When I go to run the CommandClick1 (or 2) for that matter, it errors out saying:

Run-time error '91': Object variable or With block variable not set

Any help would be appreciated, i'm sure it's something stupid that I am just not seeing.

SolidworksApi macros