Chris,
I don't know about exporting from PowerPoint to Excel or Access but I have
coded your solution to insert the slide.
This is the code:
Sub Insert_Slide(strNewTitle As String, intNewNumber As Integer)
Dim db As Database
Dim recSlideShow As Recordset
Dim strSQL As String
Dim intCurrPosition As Integer ' holds the current slide number the code is
working with
Dim result As Integer
Set db = CurrentDb
strSQL = "SELECT slide_number, slide_title FROM tblSlideShow ORDER BY
slide_number;"
Set recSlideShow = db.OpenRecordset(strSQL, dbOpenDynaset)
recSlideShow.FindFirst "slide_number = " & intNewNumber
If recSlideShow.NoMatch = True Then
result = MsgBox("There is currently no slide with this number in the
show. " & _
"Title and Number will be simply added to the table.", vbOKCancel)
If result = 0 Then ' User responded OK...
recSlideShow.Edit
recSlideShow("slide_number") = intNewNumber
recSlideShow("slide_title") = strNewTitle
recSlideShow.Update
Else ' User doesn't want the new slide added
GoTo Exit_Insert_Slide
End If
Else ' found matching slide number, will execute the insertion process
recSlideShow.MoveLast
intCurrPosition = recSlideShow("slide_number") + 1
Do Until intCurrPosition = intNewNumber
recSlideShow.Edit
recSlideShow("slide_number") = intCurrPosition
recSlideShow.Update
recSlideShow.MovePrevious
intCurrPosition = intCurrPosition - 1
Loop
recSlideShow.AddNew
recSlideShow("slide_title") = strNewTitle
recSlideShow("slide_number") = intNewNumber
recSlideShow.Update
MsgBox "Slide Inserted.", vbOKOnly, "Action Complete"
End If
Exit_Insert_Slide:
recSlideShow.Close
db.Close
Set recSlideShow = Nothing
Set db = Nothing
End Sub
You will need a form that has two text boxes on it. One that the user can
enter the new slide's title into (name the textbox “txtEnterTitleâ€) and
another that the user can enter the number position desired (named
“txtEnterTitleâ€). Then, you insert a button (let’s call that
“but_InsertSlideâ€) on the form that uses VBA to call the above subroutine.
It would look like this:
Private Sub but_InsertSlide_Click()
Call Insert_Slide(Me.txtEnterTitle, Me.txtEnterNumber)
End Sub
Then, you need to insert this code either in the code module of the form
that you are working on or in a general module.
If you have any questions, let me know. If you’d like, you can send me your
e-mail address and I can send you the entire form (I created it to make sure
it worked).