CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: OLE Control

  1. #1
    Guest

    OLE Control

    Hi Friends,

    In my Vb Application, I'm opening a Word Document in OLE Control.............But i'm unable to navigate or move to other
    pages in the document by using either mouse or arrow keys.....The Scroll bars are not at all coming...............Only the first page is
    being displayed in the OLE Control................How can i get the scroll bars or atleast how can i navigate thru other pages also....

    It's very urgent..................please help me..............

    Thanks
    Monica




  2. #2
    Join Date
    Oct 1999
    Posts
    2

    Re: OLE Control

    I am also facing excatly the same problem as u r facing. But as far as going to the next page is concerned you can use pageup and pagedown key of the keyboard.
    I will update the status as soon as i found the solution for scroll bar,keyup and keydown functionality.thanx.

    byebye
    Sunil.


  3. #3
    Join Date
    Oct 1999
    Posts
    2

    Re: OLE Control

    Hi Monica,

    here is the solution for u'r problem. Try to use the OLE container DoVerb property in the form load event as shown below:

    Form_Load()
    oleSpecs.DoVerb -1
    oleSpecs.object.ActiveWindow.DisplayVerticalScrollBar = True
    oleSpecs.object.ActiveWindow.DisplayHorizontalScrollBar = True
    End Sub

    for more details on this go to MSDN help....................
    do write me, if you found it work properly. thanx

    Now i am facing some problem in trapping the escape key on the object a OLE container contains. if u have any idea ...........
    do write me ASAP...................................

    byebye
    Sunil.


  4. #4
    Join Date
    Apr 1999
    Location
    Brooklyn, NY USA
    Posts
    171

    Re: OLE Control

    It's better to use COM. You will be able to do everything you want with your Word Document. These are some steps:
    1.Run MS Word. Go to Tools, Macro, Record New Macro, do something, like Open Document, Find something, Replace with somthing.
    2. Stop recording Macro. Through Tools, Macro, Macros highlight your new Macro and click edit. You'll see everything you did in VB Code.
    3. Start new VB project, Add "Microsoft Word 8.0 (or 9.0) Object Library" reference to your project.
    4. Place Command1 button on the form and add this code to Click event procedure:

    private Sub Command1_Click()
    Dim objWord as Word.Application
    Dim strWordDocumentName as string
    set Word = CreateObject("Word.Application")
    Word.Application.Visible = true
    Word.Application.WindowState = wdWindowStateMaximize
    strWordDocumentName = "C:\....MyDocumentName.doc" 'replace it with real name
    Word.Documents.Open FileName:=strWordDocumentName
    End Sub



    5. You can add by copying from Macro everything you are interested in into this procedure.
    Vlad


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured