Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

dsoframer.ocx control  in vb.net2008

Posted on 2011-09-26
3
Medium Priority
?
737 Views
Last Modified: 2012-05-12
I am using dsoframer.ocx control to load word documents. And I am scrolling doc by firing page down command using vb.net 2008 application (through sendkeys.send).
My problem is when I am firing page down command, after reaching to last page, how to know that word doc reached to last page so that I can execute clt+ Home command to reach again to first page.

0
Comment
Question by:ajayvegesna02
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40
ID: 36600226
Sendkeys is a very limited (and risky) way of working with another application. Since it does not provide feedback, you have no way to control what is happening in the applications.

You have to look in your ocx documentation to know if it has a feature to do what you want.

Or learn to control Word through OLE automation. You then would have a direct contact with Word and would be able to do almost anything you want. It would require more code however.
0
 

Author Comment

by:ajayvegesna02
ID: 36708337
can you provide me examples on this using vb.net 2008
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 36712152
Sorry for the delay, pretty busy these days and I haven't work on that for a while.

Here it is.
Imports Microsoft.Office.Interop.Word

Module Module1

   Public Sub WorkWithWord()

      Dim app As New Application
      Dim doc As Document
      Dim lastPage As Integer

      doc = app.Documents.Open("Your document.doc")

      With app.Selection

         .EndKey(WdUnits.wdStory)
         lastPage = CInt(.Information(WdInformation.wdActiveEndPageNumber))
         .HomeKey(WdUnits.wdStory)

         app.Visible = True

         While CInt(.Information(WdInformation.wdActiveEndPageNumber)) < lastPage

            .MoveDown(WdUnits.wdScreen, Count:=1)

         End While

         MessageBox.Show("You are at the end of the document. Press OK to go back to the top.")

         .HomeKey(WdUnits.wdStory)

      End With

      MessageBox.Show("You are back at the beginning. Press OK to get out of the application")

      app.Quit()

   End Sub

End Module

Open in new window

Ask if you have questions.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question