Page Down in Work VBA

S

Steve

I'm using Office 2000 and 2003.

I've capture input from a user and then captured a window from another
application. I then insert the user's input into a document and then paste
the screen capture right after. However, the picture of the screen doesn't
show until the macro jumps to the end of the document. The operator needs to
see that everything was capture before collecting the next set of data. Any
suggestions how I could get the data to display. I wonder if I did a page
down and page up process. Does anyone know how to do a page up or page down
in VBA. Following is an extraction of the code. Any assistance would be
greatly appreciated. Thank you in advance.

One other item while I got your attention. Once I've written all the data
to the document I need to get the focus back to the inputbox window instead
of having the operator move the cursor to select it. Which is somewhat a
pain because it is on a laptop without a mouse. Any idea how to do this
because that window doesn't show up in task manager. Thanks again for any
and all assistance provided.

Sub testcapture()

Dim answer As String
Dim tasktitle As String
Dim firsttime As Boolean

template = "SurveyCaptureScreenTemplate"
tasktitle = "Windows Task Manager"

firsttime = True
Do
answer = InputBox("Enter color and associated number and then " & vbCr & _
"click ""Ok"" ONLY when you are ready to" & vbCr & _
"capture the screen" & vbCr & vbCr & _
"Type X to exit.", WindowTitle, , 1700, 400)

If (answer = "X") Then Exit Sub
If firsttime Then
firsttime = False
Else
Selection.InsertBreak Type:=wdPageBreak
Selection.EndKey unit:=wdStory
End If
answer = UCase(Mid(answer, 1, 1)) & Mid(answer, 2, ansrlen)
Selection.TypeText answer & vbCrLf
Tasks(tasktitle).Activate
Tasks(tasktitle).WindowState = wdWindowStateNormal
ScreenCapture
Selection.Paste
Selection.TypeText " " & vbCrLf

loop
End Sub
 
D

Doug Robbins - Word MVP

I would suggest that instead of using an InputBox (and expecting that the
user will enter the correct information - color and associated number), you
should use a modeless userform with a combobox into which you load the
colors and their associated numbers.

There is also a missing End If from the code that you posted of which there
is not enough to see really what is going on.

See the article “How to create a Userform†at:
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top