Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-29-2015, 08:00 PM
ndearing ndearing is offline Scroll through pages on loop Windows 7 64bit Scroll through pages on loop Office 2013
Novice
Scroll through pages on loop
 
Join Date: Nov 2015
Posts: 2
ndearing is on a distinguished road
Default Scroll through pages on loop

Hi everyone. I am pretty new to Macros and VB but I am working on a project as follows:



I need to create a macro that scrolls down through all pages in a word doc then scrolls back up. I will need to be able to control the scroll speed, either with a timer or setting.

I am displaying our Court's docket on a display (as a word doc) and need to have it slowly scroll up and down throughout the day. The docket page length varies daily; anywhere from 1 page to 6 pages. We highlight text and markup the document throughout the day and autosave the document every 5 minutes.

Any help would be appreciated. Right now. I am simply using a timer macro to scroll down one line every 3 seconds. This means that someone needs to manually scroll the document back up to the top. I'm hoping to improve on this.
Reply With Quote
  #2  
Old 12-03-2015, 12:40 AM
macropod's Avatar
macropod macropod is offline Scroll through pages on loop Windows 7 64bit Scroll through pages on loop Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could use something like:
Code:
Sub Demo()
Dim Rng As Range, Start
Const Pause As Long = 2    ' Set duration.
Recycle:
With ActiveDocument.Range
  Set Rng = .Characters.First
  Do
    Start = Timer
    Do While Timer < Start + Pause
      DoEvents    ' Yield to other processes.
    Loop
    Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\Line")
    If Rng.End = .End - 1 Then GoTo Recycle
    With Rng
      .Collapse wdCollapseEnd
      .Select
    End With
  Loop
End With
End Sub
When the macro finishes scrolling through the document, it scrolls back to the top again and starts over.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 12-03-2015, 05:25 AM
gmaxey gmaxey is offline Scroll through pages on loop Windows 7 32bit Scroll through pages on loop Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,436
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Paul,

Here your code moved down the page lines but only displays the cursor at the start of the line. I'm not sure if the line should be selected or not. If so, this alteration of your code does that.

Code:
Sub Demo()
Dim Rng As Range, Start
Const Pause As Long = 2#
Recycle:
With ActiveDocument.Range
  Set Rng = .Characters.First
  
  Do While Rng.End < .End - 1
    Start = Timer
    Do While Timer < Start + Pause
      DoEvents    ' Yield to other processes.
      Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\Line")
      Rng.Select
    Loop
    If Rng.End = .End - 1 Then GoTo Recycle
    Rng.Collapse wdCollapseEnd
  Loop
End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #4  
Old 12-03-2015, 01:20 PM
macropod's Avatar
macropod macropod is offline Scroll through pages on loop Windows 7 64bit Scroll through pages on loop Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The idea in the code I posted was not to select the line, but only to scroll.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 12-03-2015, 06:40 PM
gmaxey gmaxey is offline Scroll through pages on loop Windows 7 32bit Scroll through pages on loop Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,436
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Paul,
Ok. Like I said, I just wasn't sure what the OP might actually want/need so I posted the variation to save them having to ask for a mod.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #6  
Old 12-17-2015, 08:46 AM
ndearing ndearing is offline Scroll through pages on loop Windows 7 64bit Scroll through pages on loop Office 2013
Novice
Scroll through pages on loop
 
Join Date: Nov 2015
Posts: 2
ndearing is on a distinguished road
Default Thank you!

Thanks you so much! This will work perfectly for what I need. I have spent alot of time messing around with this and I really appreciate such useful input.
Reply With Quote
Reply

Tags
scrolling



Similar Threads
Thread Thread Starter Forum Replies Last Post
Scroll through pages on loop Advanced page numbering: section pages in header, document pages in footer Albus Word 12 12-12-2014 01:36 PM
Page does not actively scroll with click, hold and drag on scroll-bar jbax Word 1 05-09-2013 07:16 PM
Scroll through pages on loop parallel text on even pages and on odd pages markpete Word 3 11-16-2012 03:10 AM
Scroll through pages on loop Forcing Chapter Start Pages on Odd Pages SQLUSA Word 3 08-16-2012 02:40 PM
Scroll Box john_prince Word 0 02-01-2011 03:22 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:10 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft