To implement this code, do the following: 1) Put this code into an action button, or if you're going to use it in multiple places I would recommend placing it in a script library, and calling the sub from there because it will make updating the code a LOT easier. 2) Change the variables/fields that you want to output to each column in your spreadsheet 3) When run, this will ONLY work on selected documents (i.e. have a checkmark by them on the view) 4) If you're looking for code that will write out an excel spreadsheet, and save it to your computer...THIS IS NOT IT. This code is designed to build the spreadsheet for the user, and output it in the background, then show the user the application (i.e. start excel up in the foreground for them to see the file) With that, here's the code, and if there are any problems, or questions with this code, PLEASE feel free to e-mail me at danmarquardt@pcmc.com ----------------------------------------------------------------------------------------- 'Get the data from the view Dim x As Integer Dim y As Integer Dim strLen As Integer Dim ses As NotesUIworkspace Dim vw As NotesUIView Dim coldocs As NotesDocumentCollection Dim doc As NotesDocument Dim it As Variant Dim strDesc As String Dim strTrack As String Set ses = New NotesUIWorkspace Set vw = ses.currentview Set coldocs = vw.documents Set doc = coldocs.getfirstdocument 'Set up the Excel application Dim xlApp As Variant Dim xlSheet As Variant Set xlApp = CreateObject("Excel.application") xlApp.Workbooks.Add Set xlSheet = xlApp.Workbooks(1).Worksheets(1) 'Set up column headings 'The numbers in parenthases are (row, column), the text is what you want 'your column header to be xlSheet.Cells(1, 1).Value = "Ticket #" xlSheet.Cells(1, 2).Value = "Open Date" xlSheet.Cells(1, 3).Value = "Requestor" xlSheet.Cells(1, 4).Value = "Assigned To" xlSheet.Cells(1, 5).Value = "Priority" xlSheet.Cells(1, 6).Value = "Due Date" xlSheet.Cells(1, 7).Value = "Category/Track" xlSheet.Cells(1, 8).Value = "Description" 'Format columns 'This sets the column width, this will need to be changed to fit your needs 'I've left all of the columns in here that I used to show you exactly what 'the code needs to look like to set these up...add as you need to xlSheet.Columns(1).Columnwidth = 9.6 xlSheet.Columns(2).Columnwidth = 9.29 xlSheet.Columns(3).Columnwidth = 14.5 xlSheet.Columns(4).Columnwidth = 16.75 xlSheet.Columns(5).Columnwidth = 11.5 xlSheet.Columns(6).Columnwidth = 9.29 xlSheet.Columns(7).Columnwidth = 24 xlSheet.Columns(8).Columnwidth = 45 'Here i'm setting the wraptext value on column 8, which was a very large field 'in my case...this is how you do this, remove it if needed. xlSheet.Columns(8).Wraptext = True 'The vertical alignment defaults to bottom in excel, and this makes the data look 'a LOT cleaner xlSheet.Columns(1).VerticalAlignment = 1 xlSheet.Columns(2).VerticalAlignment = 1 xlSheet.Columns(3).VerticalAlignment = 1 xlSheet.Columns(4).VerticalAlignment = 1 xlSheet.Columns(5).VerticalAlignment = 1 xlSheet.Columns(6).VerticalAlignment = 1 xlSheet.Columns(7).VerticalAlignment = 1 xlSheet.Columns(8).VerticalAlignment = 1 'Misc formatting options '- Set the print to landscape 'Values you can use: '1 = Portrait '2 = Landscape xlSheet.PageSetup.Orientation = 2 '-Underline the headings 'Here I am just underlining the text in the first row that I am using as my 'column headers xlsheet.Cells(1, 1).Font.Underline = 2 xlsheet.Cells(1, 2).Font.Underline = 2 xlsheet.Cells(1, 3).Font.Underline = 2 xlsheet.Cells(1, 4).Font.Underline = 2 xlsheet.Cells(1, 5).Font.Underline = 2 xlsheet.Cells(1, 6).Font.Underline = 2 xlsheet.Cells(1, 7).Font.Underline = 2 xlsheet.Cells(1, 8).Font.Underline = 2 '-Set the first row to be the header row 'This will set the first row up to print on the top of each page in the spreadsheet xlsheet.PageSetup.PrintTitleRows = "$1:$1" '- Set column 2 and 6 to short date format 'This will set date formats, these can be any valid format xlsheet.Columns(2).NumberFormat = "MM/DD/YYYY" xlsheet.Columns(6).NumberFormat = "MM/DD/YYYY" '-Set the page size to 80% 'When printing, this assures that all the columns will fit on one page 'You may need to experiment with this a little to find what size is right for your 'data, or maybe you don't need it to fit on one printed page. xlsheet.PageSetup.Zoom = 80 'output the data 'This is set up this way to start the outputed data at the 3rd row (I have my 'header row, and one blank row at the top of my page for looks, you can alter 'this value to start anywhere you want, but be sure that the next statement 'is always coldocs.count + 1 more than the first number '(i.e. "for x = 5 to (coldocs.count + 6)") For x = 3 To (coldocs.count + 2) 'These are your values you want outputed...the second number will be the 'column you want them in, the value after the "=" is a field on doc (which 'is the selected document that's currently being processed) xlSheet.Cells(x, 1).Value = doc.TicketID xlSheet.Cells(x, 2).Value = doc.OpenDate xlSheet.Cells(x, 3).Value = doc.Client xlSheet.Cells(x, 4).Value = doc.Tech xlSheet.Cells(x, 5).Value = doc.Priority xlSheet.Cells(x, 6).Value = doc.DueDate 'The following block of code is an example of computing a value before output 'This can be removed, but I left it here as an example 'Compute the categories strTrack = doc.SubCategory(0) + "/" + doc.SubCat2(0) xlSheet.Cells(x, 7).Value = strTrack 'This block of code is how to get RICHTEXT fields and clean them up to look nice 'in excel. First we get the field off of the document, and take JUST THE TEXT Set it = doc.getfirstitem("Description") strDesc = it.text 'Here we go through the text part of the field, and take out all the carriage returns 'that are in it, because these don't come through in excel, and look like garbage. 'loop through strDesc and pull out all the carriage returns strLen = Len(strDesc) For y = 1 To strLen If Mid(strDesc, y, 1) = Chr(13) Then Mid(strDesc,y,1)= " " End If Next 'Set the field to the modified value of the rich text field xlSheet.Cells(x, 8).Value = strDesc 'Get the next document in our collection of selected docs Set doc = coldocs.GetNextDocument(doc) Next x 'Display a message telling the user their file is ready Msgbox "Your Excel file is ready!", 64, "Excel Export" 'Show the excel application we started in the background xlApp.Visible = True