Macro to Copy Text from IE Browser and Paste in MS Word
Macro to Copy Text from IE Browser and Paste in MS Word
(OP)
I am currently developing a macro for attachmate extra!. First the report is run in attachmate using send keys, then the macro waits for an email to show up in Outlook saying that the report is complete, and copies the URL from Outlook. All of this is complete and working. I need to develop code to copy all of the text in the browser and paste into a word document. I have tried the following code, and it works for most reports; however, for one longer report, it causes the macro editor to crash. Thinking about maybe using parsing, but I am not quite sure how to get that to work here. Any help would be greatly appreciated!!
Dim HTML As Object
Dim URL As String
Dim MSWORD As Object
Dim objDOC As Object
Dim ReportText As String
Set HTML = CreateObject("MSXML2.XMLHTTP60")
URL = "www.example.com"
Set MSWORD = CreateObject("Word.Applications.8")
Set objDOC = MSWORD.Documents.Add
HTML.Open "GET", URL, False
HTML.Send
ReportText = HTML.responseText
objDOC.Content.InsertAfter ReportText
Dim HTML As Object
Dim URL As String
Dim MSWORD As Object
Dim objDOC As Object
Dim ReportText As String
Set HTML = CreateObject("MSXML2.XMLHTTP60")
URL = "www.example.com"
Set MSWORD = CreateObject("Word.Applications.8")
Set objDOC = MSWORD.Documents.Add
HTML.Open "GET", URL, False
HTML.Send
ReportText = HTML.responseText
objDOC.Content.InsertAfter ReportText
RE: Macro to Copy Text from IE Browser and Paste in MS Word
Are you using the Attachmate!Extra VB Editor, the Yugo of editors, or the Word VBA Editor, a Cadillac by comparison? I would ALWAYS opt for the latter. Never did any screen scraping to Word, but lots to Excel. NEVER used the Extra VB editor!
Actually interested that you’re using a terminal emulator to access the internet. Always used a terminal emulator to emulate a 3270 terminal interfacing an IBM mainframe.
I suppose your Extra HELP has all the screen manipulation commands for the type of terminal (HTML?) you’re emulating. But since it seems to be a capacity issue, (“for one longer report, it causes the macro editor to crash”) maybe a different editor would not crash.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Macro to Copy Text from IE Browser and Paste in MS Word
RE: Macro to Copy Text from IE Browser and Paste in MS Word
Your application is ending up with a Word document. Just a suggestion.
Skip,
Just traded in my OLD subtlety...
for a NUance!
RE: Macro to Copy Text from IE Browser and Paste in MS Word
BUT...
I tried to get my coworker to try running the report with the macro as well, and his isn’t working. It cannot connect to the “active session” in Extra! Attachmate.
Any thoughts?