Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default CreateObject("InternetExplorer.Application")


This is the code so far:


Code:
--------------------
Sub InternetExplorer()
Dim IExp As InternetExplorer
Dim sPage As String
Set IExp = CreateObject("InternetExplorer.Application")

IExp.Visible = True
IExp.Navigate "http://localhost/login?login=demoname&password=demopass"

'Do Until IExp.readyState = READYSTATE_COMPLETE
' DoEvents
'Loop
'IExp.Quit
End Sub
--------------------


I need to click on this link:


Code:
--------------------
<a href="CuO_AAmB/WBPN" title="View stats on sales by item"
onMouseOver="window.status='View stats on sales by item'; return true;" onMouseOut="window.status='';"Sales</a<br
--------------------


The problem? - The href changes everytime we log into the system, both
before and after the forward-slash ("/"), I am pretty sure it is
Yahoo's way of tracking the session.

From recording macros I know that the link is in table 22, and that it
is the second link in the table. Is there VBA for simply clicking on
the link and then using the page it links to as the data source?

I want to import a table on the page this link links to into excel as a
data source, is there any other way to automate the table import?

Thank You.
Simon.



I have the code excel generates, it pretty much stays the same from
this point, the name is changes to whatever is in to the left of the
"/" in the link above:


Code:
--------------------

Sub Macro1()
'
' Macro1 Macro
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;Http://localhost/login?ag63hresb6fn2&.done=http://storelink/_", _
Destination:=Range("A1"))
.Name = "CuO3wAj_"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "22"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Range("A3").Select
End Sub



--------------------


--
shart
------------------------------------------------------------------------
shart's Profile: http://www.excelforum.com/member.php...o&userid=29563
View this thread: http://www.excelforum.com/showthread...hreadid=497325

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default CreateObject("InternetExplorer.Application")


Hello

if you know the index of the link , you may try


Sub declencherLienPageWeb()
'Microsoft HTML Objects Library
'Microsoft Internet Controls
Dim IE As New InternetExplorer
Dim Cible As HTMLAnchorElement
Dim Doc As HTMLDocument

IE.Navigate "http://www.webPage.html"
IE.Visible = True
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop

Set Doc = IE.Document
Set Cible = Doc.Links(20)

Cible.Click
End Sub



to import the table , you could adapt this exemple


Sub Importer_tableauPageWeb()
Dim IE As InternetExplorer
Dim maPageHtml As HTMLDocument
Dim Htable As IHTMLElementCollection
Dim maTable As IHTMLTable
Dim j As Integer, i As Integer

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

IE.navigate "http://www.webPage.html"
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop

Set maPageHtml = IE.document
Set Htable = maPageHtml.getElementsByTagName("table") 'objet type
table
Set maTable = Htable(0) ' the first table

For i = 1 To maTable.Rows.Length ' table rows

For j = 1 To maTable.Rows(i - 1).Cells.Length ' each cell of the row
Cells(i, j) = maTable.Rows(i - 1).Cells(j - 1).innerText
Next j

Next i
End Sub



Regards
michel


--
michelxld
------------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...o&userid=17367
View this thread: http://www.excelforum.com/showthread...hreadid=497325

Reply
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
CreateObject("Excel.Application") Olivia Towery Excel Worksheet Functions 4 June 12th 06 12:07 AM
Permission denied in CreateObject(Excel.Application") Leo Excel Programming 1 December 15th 05 05:06 PM
Set OutApp = CreateObject("Outlook.Application") - Runtime error 429 Buffyslay Excel Programming 2 July 20th 05 05:06 PM
ASP: CreateObject("Excel.Application") IIS 6.0 Win2003 Mau[_2_] Excel Programming 0 July 20th 05 11:45 AM
CreateObject("Excel.Application") - Access denied Luca[_2_] Excel Programming 0 February 6th 04 01:21 PM


All times are GMT +1. The time now is 02:25 AM.

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"