Share via

VBA to click on a javascript link

Anonymous
2011-03-21T14:59:01+00:00

Hello, I would really appreciate some help here. 

I have written a series of macros in Excel that will be run through Access 2003.  The Access Macros take data from a web page, copy, paste it in Excel, and the Excel Macros alter the data. 

I need VBA in Access to be able to open a link, and click on a Java link.  When I click on the link I want (manually) it says "javascript:submitForm('IL',")", so I assume I can have the Access code click this link? 

here is my code run from an Access onclick button:

Private Sub Command10_Click()

Set myIE = CreateObject("InternetExplorer.Application")

'Navigates to a site

myIE.Navigate "http:\internal.site.asp"

myIE.Visible = True

'Waits 3 seconds to give page time to load

TWait = Time

TWait = DateAdd("s", 3, TWait)

Do Until TNow >= TWait

     TNow = Time

Loop

'Cheesy way to copy the pages info

SendKeys "^a"

SendKeys "^c"

'Opens Excel, pastes the value

Dim OpenExcel As Object

    Set OpenExcel = CreateObject("Excel.Application")

    DoCmd.Hourglass True

    OpenExcel.Workbooks.Open \\shareddrive\filename.xls

    OpenExcel.Visible = True

    DoCmd.Hourglass False

    TWait = Time

    TWait = DateAdd("s", 3, TWait)

    Do Until TNow >= TWait

    TNow = Time

    Loop

'Excel macros will run here, I still need to figure out how to call them

End Sub

I am having a hard time figuring out how to open each of the javascript links, to do this procedure over again.

I really hope I am making sense :(  Please help!  I am so close to my goal!

Thanks again, Brent Surphlis

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2013-10-28T00:56:52+00:00

    Brent

    Its been over 2 years since you posted your question. I am surprised no one answered and I would guess that there is no solution.

    I am in a similar situation so I would like to know if you ever found out a solution.

    Cheers

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-03-22T02:51:19+00:00

    Has this site died?  Something has changed... The site looks different, and post views have dropped by an alarming number... I guess this place is not what it used to be :(

    This is very disappointing, but thanks to all the gurus who answered my questions in the past.

    Was this answer helpful?

    0 comments No comments