How to Add a file to PDM using solidworks API

Okay, I have fought with this long enough, time to ask the genius of the forum community.

I have a macro that saves a drawing as a PDF into our PDM professional vault, problem is that it is grayed out because it is a local version. I can right click and add to the vault, but I would like for this macro to not only add it to the vault but to also check it in. I have poured over the PDM API help files and am still so lost. I find the way the help files code things very difficult to understand. My visual basic skill is growing but pretty beginner level still.

This is what I have but my very last line seems to be an issue I can't figure out what to do with it.

<p>Dim swApp As SldWorks.SldWorks</p><p>Dim swModel As SldWorks.ModelDoc2</p><p>Dim swDraw As SldWorks.DrawingDoc</p><p>Dim Filepath As String</p><p>Dim FileName As String</p><p>Dim boolstatus As Boolean</p><p>Dim longstatus As Long, longwarnings As Long</p><p>Dim vault1 As New EdmVault5</p><p></p><p>Sub main()</p><p></p><p></p><p>Set swApp = Application.SldWorks</p><p>Set swModel = swApp.ActiveDoc</p><p>' Check to see if a drawing file is loaded.</p><p></p><p>If (swModel Is Nothing) Or (swModel.GetType <> swDocDRAWING) Then</p><p></p><p></p><p>swApp.SendMsgToUser ("Only for use with Drawings")</p><p></p><p></p><p>Exit Sub</p><p></p><p></p><p>End If</p><p></p><p></p><p>' vault login</p><p></p><p></p><p>vault1.LoginAuto "SPECTRUM", 0</p><p></p><p></p><p> ' Set filepath and add tag on file name using custom properties</p><p></p><p>Set swDraw = swModel</p><p>Dim Rev As String</p><p>Dim folder As String</p><p></p><p></p><p>Rev = swModel.CustomInfo("Revision")</p><p></p><p></p><p>Filepath = "C:\\SPECTRUM\\Spectrum\\Shop Pdf Access\\"</p><p></p><p></p><p>If Right(Filepath, 1) <> "\\" Then</p><p>Filepath = Filepath & "\\"</p><p>End If</p><p></p><p></p><p>FileName = Left(swDraw.GetTitle, Len(swDraw.GetTitle) - 10)</p><p>file = Filepath + FileName + " - " + Rev + ".PDF"</p><p>swDraw.SaveAs (file)</p><p></p><p></p><p>'add and checkin to vault</p><p></p><p></p><p>vault1.RootFolder.AddFile 0, Filepath, file, 0</p><p></p><p></p><p>End Sub</p>
SolidworksApi/macros