Results 1 to 6 of 6

Thread: Print data to Word document

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Location
    CapeTown,South-Africa
    Posts
    22

    Unhappy

    HI all,

    I'am printing to a word document.
    When I reopen the document I print at die top of the document.

    Who can I get to the buttom of the document, or send Ctrl +end send to the word document.

    Thanks.

  2. #2
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    Not sure about this as I have not tried it yet.

    If you have a Word Object in your VB Application can you not do this?

    MyWordObject.GoTo.End

    If this does not work try the SendKeys method? Just some thoughts. I will go and try it now.




  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Location
    CapeTown,South-Africa
    Posts
    22

    Thumbs down

    HI all,

    I tried it but still write at top of document.

    ObjWord.ActiveDocument.GoTo.EndOf

    Any other options ? How would the sendkeys work?




  4. #4
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184
    This works, I've just tried it.


    wdApp.Visible = True
    wdApp.Activate 'Activate Word.
    SendKeys "^{END}", True 'Send CTRl+END to go to end.

    Hope this helps.


  5. #5
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    To send the <Ctrl> + <End>, you could use the SendKeys thingie. However, I like this way of navigating better:
    Code:
    With myWordObj.Selection
      .EndKey wdStory       ' End of Doc
      .HomeKey wdStory      ' Start of Doc
      .EndKey wdLine        ' End of Line
      .HomeKey wdLine       ' Beginning of Line
      .MoveRight wdWord, 1  ' One Word right
      .MoveLeft wdWord, 1   ' One Word left
    End With
    To insert a <Tab> or <Enter> character in your document use this:
    Code:
    With myWordObj.Selection
      .TypeText vbTab  ' TAB character
      .TypeParagraph   ' ENTER character
    End With
    With respect to make Word running hidden, just set it's Visible property to False. See also my post on how to properly interact with MS Word here http://forums.vb-world.net/showthrea...threadid=23336.

    Hope this helps.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Location
    CapeTown,South-Africa
    Posts
    22

    Unhappy

    HI Thanks HaxSoft


    It works now . I still have I problem with the tab.


    Name : Stephan
    Date of birth : 13/03/67


    Must look like
    Name : Stephan
    Date of birth : 13/03/67
    Problem with website ,but the : must be directly under each other.


    Can anybody help ,with change the tab starting adress perhaps.










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