When I export to Excel, it saves my file in the folder I've designated - no problem. However, it also creates a duplicate file - Book1 - which doesn't get saved but just hangs in the background. I don't see it until I attempt to shut down ,at which time I have to answer "No" to saving it in order to finish shutting down. I looked for a problem statement like this in the forum and didn't see anything similar, so my apologies in advance if I'm asking something that's been answered before.
Here's the code I'm using:
Sub Click(Source As Button)
Dim ses As New NotesSession
Dim db As NotesDatabase
Dim View As NotesView
Dim doc As NotesDocument
Dim xl As Variant
Dim ka As String
Set db = ses.currentdatabase
Set view = db.getview("User Assets")
Set doc = view.getfirstdocument
Set xl = createobject("Excel.Application")
x = 2 'puts first data line in row 2
Do Until Doc Is Nothing
xl.Range("A"&x).value = doc.StaffMemberDisp
xl.Range("B"&x).value = doc.ItemDisp
xl.Range("C"&x).value = doc.SerialNbrDisp
x = x + 1
Set doc = view.getnextdocument(doc)
xl.Range("A1").Font.Size = 12
xl.Range("A1").Font.Bold = True
xl.Range("A1").ColumnWidth = 24
xl.Range("A1").value = "Owner"
xl.Range("B1").Font.Size = 12
xl.Range("B1").Font.Bold = True
xl.Range("B1").ColumnWidth = 37
xl.Range("B1").value = "Item"
xl.Range("C1").Font.Size = 12
xl.Range("C1").Font.Bold = True
xl.Range("C1").ColumnWidth = 8
xl.Range("C1").value = "Serial Number"
xl.ActiveWorkbook.SaveCopyAs("C:\Asset Reports\User Report.xls")
xl.visible = False
Msgbox "The Excel file has been saved to your Asset Reports folder as 'User Report'.", 64, "Excel Report"