LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Is there a way to do this without using notepad?

I am writing a macro for my users that grabs info off of a web page.
I want it to open a new worksheet with the info on it so that I can
work on it.

Below is my code it uses *ug* sendkeys and notepad to convert
documentelement.html into a text file is there a way of doing this
without using a program external to excel?

if not is there a way to close notepad without notepad asking if I want
to save?

Dim oIE As New SHDocVw.InternetExplorer
Dim sURL As String
Dim MyAppID As Long
sURL = "http://www.w3.org/2002/ws/" 'the page I'm loading is
'on the intranet but this is good for an
example

'open a new, visible IE window
Set oIE = New SHDocVw.InternetExplorer
oIE.Visible = false

'go to desired page
oIE.Navigate sURL

'wait for page to finish loading
Do Until oIE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

MyAppID = Shell("notepad", 1)
DoEvents
On Error Resume Next
AppActivate "microsoft ex"
Application.DisplayAlerts = False

Worksheets("Webcopy").Delete

Application.DisplayAlerts = True
ActiveWorkbook.Sheets.Add
ActiveSheet.Name = "Webcopy"
Range("A1") = oIE.Document.documentelement.innerhtml
Range("A1").Copy
AppActivate "Untit"
DoEvents
SendKeys "^v"
DoEvents
SendKeys "%ea"
DoEvents
SendKeys "^c"
DoEvents
SendKeys "% c"
DoEvents
ActiveSheet.Range("A1").ClearContents
ActiveSheet.Paste
oIE.Quit

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert notepad .txt to xp .xl Dave Excel Discussion (Misc queries) 2 February 29th 08 12:52 PM
Notepad to excel T Miller Excel Discussion (Misc queries) 5 October 19th 06 10:56 PM
Pasting from Notepad Al Excel Discussion (Misc queries) 1 June 14th 05 02:41 AM
NotePad OldCCN Excel Programming 1 July 7th 04 07:40 PM
notepad in excel Mohan[_2_] Excel Programming 1 August 29th 03 03:08 PM


All times are GMT +1. The time now is 09:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"