If statement causing issues communicating with excel

Hey guys,

so my code was running fine until i added the first if statement the code is meant to save a step file export info the an excel spreadsheet and then send an email notification to let them know the spreadsheet was updated.  it worked fine until i added an if statement asking if it was a new part for this case i just want it to save the step file.  

now it gives me the error user defined type not defined here

' Opens Excel and makes it Visible
Set xlApp = New excel.Application
xlApp.Visible = True

the code is attached does any body know why i might be getting the error?

any help would be greatly appreciated. 

SolidworksApi/macros