selecting a tab on a website

Jackblack1

Active Member
Joined
Feb 10, 2004
Messages
266
Hi all

Sorry about the other thread....figure it had a relationship, but anywho, :oops:

I have worked a on the macro a little but still have problem trying to figure out how to make it work. I can log into a website using the username and password but now I get to the opening page. Starting from the opening page I need to tab over to a tab name reporting. If you were to use the tab button it would 7 tabs to get to the reporting, I tried Send Keys but they do not work, aslo I tried something from another post.

Sub test()
Set ie = CreateObject("InternetExplorer.application")
ie.Visible = True
ie.navigate ("https://www.example.com)<----- not real site
Do
If ie.readyState = 4 Then
ie.Visible = True
Exit Do
Else
DoEvents
End If
Loop

ie.document.forms(0).all("Username").Value = "mahonse"
ie.document.forms(0).all("Password").Value = "example"
ie.document.forms(0).submit
Application.Wait (Now + TimeValue("00:00:12"))

Set myTextField = .document.all.Item("Reporting")
ie.document.forms(0).submit


End Sub
 
Hi Norie

That is correct, what I need is the code to click on those links, although they take you to a different link, it is the functionality that I am looking for, or rather the vb code.

thanks
 
Upvote 0
Jim

I don't think this is going to be easy, even if it's possible.

That page relies heavily on JavaScript to show menus etc

I don't really think VBA/Excel is the correct tool to do whatever it is you want to do.
 
Upvote 0
Good morning folk

With a little luck I think I have found the next step, After logging into the site, instead of clicking on the tabs I went into the properties and found the links address, I put a 5 second delay on the each time the link is submitted. Now If someone knows of an easier way please let me know.

What my problem not is that, when one final submits the report, there is a date in the reports address, I need this to be flexable according to the present date, and in some cases there is a monthly report. so how can I set this up so that it is not set on specific date. The date is hightlighted below:

Sub test()

Dim sFileName As String, sPath As String, sfile As String

Set ie = CreateObject("InternetExplorer.application")
ie.Visible = True
ie.navigate ("https://www.example.com")
Do
If ie.readyState = 4 Then
ie.Visible = True
Exit Do
Else
DoEvents
End If
Loop
myuser = Application.InputBox("Please Enter a Valid Username, If you have entered this site by mistake please close your browser.")
ie.document.forms(0).all("Username").Value = myuser
mynum = Application.InputBox("Please Enter a Valid Password, If you have entered this site by mistake please close your browser.")
ie.document.forms(0).all("Password").Value = mynum
ie.document.forms(0).submit

If Application.Wait(Now + TimeValue("0:00:05")) Then

ie.navigate ("www.example.com/reports=12345") <----links address
End If

If Application.Wait(Now + TimeValue("0:00:05")) Then

ie.navigate ("https://www.example.com/reports/5008194/053106/fedo~^DAILY_WORKBOOK_31_MAY_2006_ALL^.XLS") <-----reports needed
End If

Application.DisplayAlerts = False

sPath = "R:\officeworks\FA\full\STL\cpt\SL WEB\DAILY\ALl.xls"

ActiveWorkbook.SaveAs Filename:=sPath & sFileName, FileFormat:= _
xlExcel9795, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False

Application.DisplayAlerts = True
 
Upvote 0
Jim

You can easily insert a date.
Code:
ie.navigate ("https://www.example.com/reports/5008194/053106/fedo~^DAILY_WORKBOOK_" & Format(Date, "DD_MMM_YYYY_ALL") &"^.XLS") <-----reports needed
 
Upvote 0
This makes total sense, but here is something else, the code only submits the link if it is the present day for example, fedo~^DAILY_WORKBOOK_" & Format(Date, "02_Jun_2006_ALL") &"~^.XLS").
The reports are dated for yesterday, and the reason I need it flexible is because of the the weekend dates. I could put (date, -1 "dd_mmm_yyyy_all") but that will not pull in the weekends, any ideas.

ie.navigate ("https://www.example.com/reports/5008194/053106/fedo~^DAILY_WORKBOOK_" & Format(Date, "DD_MMM_YYYY_ALL") &"~^.XLS")
 
Upvote 0
Jim

There are plenty of VBA date functions - DateAdd, WeekDay etc

You should be able to use them to get the required date.
 
Upvote 0

Forum statistics

Threads
1,226,841
Messages
6,193,289
Members
453,788
Latest member
drcharle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top