I am attempting to log (1. what slide and 2. the time) to a spreadsheet each time a slide is viewed in presentation mode. I don't want to have the spreadsheet open when I do this and I want it to save automatically. I've been screwing around with it for a few hours now, and I've had varying success. I can't seem to get it to work as intended.

Here's the code I've crammed together so far:

```
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
    Dim appExcel As Excel.Application
    Dim wkb As Excel.Workbook
    Dim wks As Excel.Worksheet
    Dim strSheet As String
    Dim strPath As String
    Dim curentSlide As Integer
    Dim timez As Date
    Dim z As Integer
    strSheet = "test.xlsx"
    strPath = "C:\PPToutput\"
    strSheet = strPath & strSheet
    Dim counter As Integer
    counter = 0
    counter = counter + 1

    currentslide = ActivePresentation.SlideShowWindow.View.Slide.SlideIndex
    timez = Now()

    If Not IsNull(appExcel) And counter < 2 Then
        Set appExcel = CreateObject("Excel.Application")
        appExcel.Application.DisplayAlerts = False
        appExcel.Workbooks.Open (strSheet)
        Set wkb = appExcel.ActiveWorkbook
        Set wks = wkb.Sheets(1)
        wks.Activate
    End If
    appExcel.Application.Visible = True
    Range("A" & Rows.Count).End(xlUp).Offset(1).Value = "Slide " & currentslide
    Range("B" & Rows.Count).End(xlUp).Offset(1).Value = timez
    wks.Columns.AutoFit
    wkb.SaveAs
    Set appExcel = Nothing
    appExcel.Workbooks.Close
    appExcel.Quit
    Set appExcel = Nothing
End Sub

```