Accessing the drawing number thru VBA

I am looking to save files as TIF files. I have the macro for that part working, but the macro saves as the model name, not the Dwg No property, which are different. I have changed the macro to match some of the other discussions, but I am just getting errors. Any help would be great. This is the macro I currently have:

Dim longstatus As Long, longwarnings As Long

Dim Feature As Object

Dim swSheet As SldWorks.Sheet

Dim swDraw As SldWorks.DrawingDoc

Dim bRet As Boolean

Dim i As Long

Dim vSheetProps As Variant

Const swTiffPrintScaleToFit As Long = 28

Const swTiffScreenOrPrintCapture As Long = 6

Const swTiffImageType As Long = 7

Const swTiffCompressionScheme As Long = 8

Const swTiffPrintDPI As Long = 9

Const swTiffPrintPaperSize As Long = 10

Sub main()

Set swApp = Application.SldWorks

Set swModel = swApp.ActiveDoc

f = "C:\SOLIDWORKS COMPONENTS\New folder\"

Debug.Print "PrintScaleToFit        = " + Str(swApp.SetUserPreferenceToggle(swUserPreferenceToggle_e.swTiffPrintScaleToFit, True))

Debug.Print "ScreenOrPrintCapture   = " + Str(swApp.SetUserPreferenceIntegerValue(swTiffScreenOrPrintCapture, 1))

Debug.Print "allorcurrentsheet      = " + Str(swApp.SetUserPreferenceIntegerValue(swallorcurrentsheet, 1))

Debug.Print "ImageType              = " + Str(swApp.SetUserPreferenceIntegerValue(swTiffImageType, 0))

Debug.Print "CompressionScheme      = " + Str(swApp.SetUserPreferenceIntegerValue(swTiffCompressionScheme, 2))

Debug.Print "PrintDPI               = " + Str(swApp.SetUserPreferenceIntegerValue(swTiffPrintDPI, 200))

Debug.Print "PrintPaperSize         = " + Str(swApp.GetUserPreferenceIntegerValue(swTiffPrintPaperSize))

file = Dir(f)

    Do While file <> ""

    filen = f + file

    namelength = Len(filen)

    filetype = Mid(filen, (namelength - 5), 7)

    namelength1 = Len(file)

    filename1 = Mid(file, 1, (namelength1 - 7))

    Debug.Print file

    Debug.Print filename1

    lcasefiletype = LCase(filetype)

        If lcasefiletype = "slddrw" Then

                Set Part = swApp.OpenDoc6(filen, 3, 0, "", longstatus, longwarnings)

                swApp.OpenDoc6 filen, 3, 0, "", longstatus, longwarnings

                Set swModel = swApp.ActiveDoc

                Set swDraw = swModel

                        bRet = swDraw.ActivateSheet("Sheet1")

                        Set swSheet = swDraw.GetCurrentSheet

                        vSheetProps = swSheet.GetProperties

    Debug.Print "  TemplateName              = " & swSheet.GetTemplateName

    Debug.Print "  PaperSize                 = " & vSheetProps(0)

    Debug.Print "PrintPaperSize         = " + Str(swApp.SetUserPreferenceIntegerValue(swTiffPrintPaperSize, vSheetProps(0)))

                        Part.SaveAs2 f + filename1 & ".TIF", 0, True, False

                Set Part = Nothing

                swApp.CloseDoc f + file

        Else

        End If

    file = Dir()

Loop

End Sub

SolidworksApi macros