Sub PatPresentation() ' Visual Basic for Applications (VBA) ' Dim pageSequence As String ' pageSequence = "" ' pageSequence = "26,11,13,14,15,18,22,32,10,6,19,30,16,25,28,33," ' OSAS debate with non Calvinist ' pageSequence = "2,3,4,6,8,5,7," ' Miraculous Gifts debate ' pageSequence = "2,5,6,7,8,9,24," ' probably 26,30,31 Women Preachers debate - negative ' pageSequence = "20,2,3,4,6,10,8,9," ' Six Cases lesson ' pageSequence = "33,13,14,15,16,2,3," ' pageSequence = "1,2,4,5,9,3,152,6,8,7,10," ' Baptism Purpose ' pageSequence = "11,13,14,15,18,22,31,32,25,9,17,5,10,19,27,6,30,16,26," ' OSAS debate with Calvinist ' pageSequence = "45,51,52,47,48,53,54,60,61,58,63,9,17,112,111,19,20,21,22,46,117," ' Substitutionary Death ' pageSequence = "2,3,4,5,13,14,15,16," ' Covering sermon ' pageSequence = "1,2,3,5,6,7,8,9,10,13,14,15,16,17,19,20,21,22,23,24,25,26,27,28,29,30,31,33," ' Plain Meaning sermon ' ' PatPresentation Macro ' Macro created 11/3/2005 by Patrick Donahue ' Dim psArray() As String psArray = Split(pageSequence, ",") Dim ndx As Integer Dim curPage As Integer Dim lastPage As Integer lastPage = ActiveDocument.Content.Information(wdNumberOfPagesInDocument) ' just to make sure a funny printer won't mess me up 4-4-2024 ' Dim Default_Printer_Name As String 'Default_Printer_Name = Application.ActivePrinter ' MsgBox "Default_Printer_Name = " & Default_Printer_Name 'Application.ActivePrinter = "Microsoft Print To PDF" ' this statement causes my main computer to run out of memory ' MsgBox "Application.ActivePrinter = " & Application.ActivePrinter ' Jonathan Perz changed "Top Margin" to 0.4 ' make Landscape width an extra half inch to cover if my margins are too small for the imaginary printer ' Jonathan Perz changed next line to 1000 'ActiveDocument.PageSetup.PageWidth = 828 ' 828 points = 11.5 inches - 3-30-2024 'ActiveDocument.PageSetup.PageWidth = InchesToPoints(11.5) ' 3-30-2024 'MsgBox "The page width is " & PointsToInches(ActiveDocument.PageSetup.PageWidth) & " inches" 'ActiveDocument.PageSetup.PageHeight = InchesToPoints(9) ' 4-3-2024 'MsgBox "The page height is " & PointsToInches(ActiveDocument.PageSetup.PageHeight) & " inches" ActiveDocument.PrintPreview ' go into Print Preview mode ActiveWindow.ActivePane.View.Zoom.PageFit = wdPageFitFullPage ' use Whole Page Zoom mode ' Jonathan Perz changed next line to 95 ActiveWindow.ActivePane.View.Zoom.Percentage = 120 ' was 100 before 3-30-2024 ActiveWindow.View.FullScreen = True ' go into Full Screen mode ActiveDocument.Background.Fill.Visible = False ActiveWindow.DisplayVerticalScrollBar = False ' get rid of Vertical Scroll Bar CommandBars("Print Preview").Visible = False ' get rid of Print Preview menu line CommandBars("Full Screen").Visible = False ' get rid of Full Screen toggle switch CommandBars("Control Toolbox").Visible = False ' get rid of Control Toolbox thingy CommandBars("Exit Design Mode").Visible = False ' get rid of Exit Design Mode thingy System.Cursor = Word.WdCursorType.wdCursorNorthwestArrow ' make cursor an arrow instead of hourglass Dim nPut As String MsgBox ("Instructions: type ..." & vbCrLf & vbCrLf & " then Enter to go to a specified chart" & vbCrLf & "Enter only to go to next page in Sermon sequence" & vbCrLf & "b then Enter to go to previous page in Sermon sequence" & vbCrLf & "u or p then Enter to PageUp" & vbCrLf & "d or n then Enter to PageDown" & vbCrLf & "x or q then Enter to Exit") If UBound(psArray) = -1 Then ' no sequence to follow nPut = lastPage ' "1" Else nPut = psArray(0) End If Selection.GoTo What:=wdGoToPage, Name:=nPut Do While True nPut = InputBox("Chart Number ?", "Go To", "", 19000, 19000) ' place InputBox off the screen (hidden) If nPut = "exit" Or nPut = "x" Or nPut = "q" Then ActiveWindow.DisplayVerticalScrollBar = True ' put back Vertical Scroll Bar ActiveWindow.DisplayHorizontalScrollBar = True ' put back Horizontal Scroll Bar ' put back Paper Size ' ActiveDocument.PageSetup.PageWidth = 792 ' put back 792 points = 11 inches - 3-31-2024 ' ActiveDocument.PageSetup.PageWidth = InchesToPoints(11) ' 3-31-2024 ' ActiveDocument.PageSetup.PageHeight = InchesToPoints(8.5) ' 4-3-2024 'Application.ActivePrinter = Default_Printer_Name ' put back active printer Exit Do ElseIf nPut = EscapeKey Or nPut = "f" Then ' forward in sequence (EscapeKey is Return) curPage = Selection.Information(wdActiveEndPageNumber) ' MsgBox "curPage" & curPage & ", UBound(psArray)=" & UBound(psArray) If UBound(psArray) = -1 Then ' no sequence Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext ElseIf curPage = Int(psArray(UBound(psArray) - 1)) Then Selection.GoTo What:=wdGoToPage, Name:=lastPage Else For ndx = 0 To UBound(psArray) - 1 If Int(psArray(ndx)) = curPage Then If Int(psArray(ndx + 1)) > lastPage Then Selection.GoTo What:=wdGoToPage, Name:=lastPage Else Selection.GoTo What:=wdGoToPage, Name:=psArray(ndx + 1) End If ' Selection.GoTo What:=wdGoToPage, Name:=psArray(ndx + 1) Exit For End If Next ndx ' MsgBox "ndx=" & ndx & ", UBound(psArray)=" & UBound(psArray) ' MsgBox "psArray(ndx+1)=" & psArray(ndx) & ", lastPage=" & lastPage If ndx = UBound(psArray) Then Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext End If ElseIf nPut = "b" Then ' backwards in sequence curPage = Selection.Information(wdActiveEndPageNumber) 'MsgBox "curPage=" & curPage 'MsgBox "lastPage=" & lastPage 'MsgBox "UBound(psArray)=" & UBound(psArray) If UBound(psArray) = -1 Then ' no sequence Selection.GoTo What:=wdGoToPage, Which:=wdGoToPrevious ElseIf curPage = lastPage Then Selection.GoTo What:=wdGoToPage, Name:=psArray(UBound(psArray) - 1) Else For ndx = 1 To UBound(psArray) - 1 'MsgBox "CurPage=" & curPage & " psArray(ndx)=" & psArray(ndx) & " psArray(ndx+1)=" & psArray(ndx + 1) If Int(psArray(ndx)) = curPage Then Selection.GoTo What:=wdGoToPage, Name:=psArray(ndx - 1) Exit For End If Next ndx If ndx = UBound(psArray) Then Selection.GoTo What:=wdGoToPage, Which:=wdGoToPrevious End If ElseIf nPut = "d" Or nPut = "n" Then Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext ElseIf nPut = "u" Or nPut = "p" Then Selection.GoTo What:=wdGoToPage, Which:=wdGoToPrevious ElseIf IsNumeric(nPut) Then ' MsgBox "nPut=" & nPut & " lastPage=" & lastPage If Int(nPut) < 1 Then nPut = 1 If Int(nPut) > lastPage Then nPut = lastPage ' it doesn't work on Carol's computer, which is because ' www.BibleDebates.info is displayed as hyperlink on Carol's computer spilling over onto the next page; ' make it not a hyperlink Selection.GoTo What:=wdGoToPage, Name:=nPut End If Loop Selection.EscapeKey Selection.EscapeKey End Sub