Consulting

Results 1 to 2 of 2

Thread: Copy webcontent to a document

  1. #1
    VBAX Contributor
    Joined
    Jun 2014
    Posts
    114
    Location

    Copy webcontent to a document

    Hello all VBA Members

    I am trying to auotmate a process of word

    I get lots of different wordjobs, they always have a job number, for example 741443
    we have a webpage where we can see all active jobs, as we see both job numbers (741443)
    and also an EP-number (E7295_EP2586715)

    I want to copy this part of the EP-number (EP2586715) to a word document.

    the word document is always in the folder called 741443.

    my problem is, when there are several different jobs with different EP-numbers,
    the macro need to copy the correct EP-Code from the webpage to the document.

    here is a picture
    Untitled-1.jpg
    how it looks like



    Do have someone a solution for this?


    here is a sample I did,
    but the pastemethod doesn't work


    HTML Code:
    Sub CopyWebContent()
     
        
    Dim IE As Object
    Dim rng1 As Range
    Dim thisdoc As Document
    Dim newdoc As Document
    Dim st
    Set thisdoc = ActiveDocument
    Set newdoc = Documents.Add
    Documents(thisdoc).Activate
               
     
        
        Set IE = CreateObject("InternetExplorer.Application")
        With IE
            .Visible = True
            .navigate "tsq/"
            Do Until .ReadyState = 4: DoEvents:  Loop
            End With
            IE.ExecWB 17, 0 '// SelectAll
            IE.ExecWB 12, 2 '// Copy selection
         
       
                   Selection.Paste
     
        
       
           Set rng1 = Selection.Range
     
           '  IE.Quit
            
        End Sub

    Thank you in advance all VBA Members

    Cheers!

    Daniel
    Last edited by elmnas; 07-14-2014 at 03:01 AM.

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Cross-posted at: http://www.msofficeforums.com/word-v...-document.html
    For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184. See also: http://www.vbaexpress.com/forum/faq...._new_faq_item3

    I note you have previously been asked to observe the etiquette (e.g. http://www.vbaexpress.com/forum/show...ctive-location). I have known people to be banned from VBA Express for refusal to observe this basic courtesy.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Tags for this Thread

Posting Permissions

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