VBA » Compile Error Object required.

gg

Well-known Member
Joined
Nov 18, 2003
Messages
560
I am getting a compile Error in Access.
I am guess I need a reference??

Currently I have checked.
"Visual Basic for applications"
"Microsoft Access 11.0 Object Library"

The Editor is highlighted section
Rich (BB code):
 Set lnk = QPR.Document.Links(3)

Any suggestions?

Rich (BB code):
Public Function SKPIUPDATE()
Dim QPR
Dim lnk As Integer
Dim frm
Dim dwn
Dim Start
Dim fin
Dim drp1
Dim drp2
Dim drp3
Dim src1

' This macro will automatically open and download the TMMK-VEH daily scrap
'and store the file in the same directory

Set QPR = CreateObject("InternetExplorer.application")

    QPR.Visible = True
    
    QPR.navigate "https://www.portal.toyotasupplier.com/wps/myportal/"
    
  TimeOut = Now + TimeValue("00:00:10")  '-- wait maximum of 10 seconds
   Do While QPR.Busy Or QPR.readyState <> 4
      DoEvents
      If Now > TimeOut Then
         MsgBox "Time Out before Login"
         Exit Function
      End If
   Loop

   With QPR.Document.Forms("Login")
      .User.Value = "*****"
      .Password.Value = "*****"
      .submit
   End With

   TimeOut = Now + TimeValue("00:00:10")  '-- wait maximum of 10 seconds
   Do While QPR.Busy Or QPR.readyState <> 4
      DoEvents
      If Now > TimeOut Then
         MsgBox "Time Out after Login"
         Exit Function
      End If
   Loop

    QPR.navigate ("https://www.portal.toyotasupplier.com/skpi/")
    
    TimeOut = Now + TimeValue("00:00:05")  '-- wait maximum of 5 seconds
   Do While QPR.Busy Or QPR.readyState <> 4
      DoEvents
      If Now > TimeOut Then
         MsgBox "Time Out after Login"
         Exit Function
      End If
   Loop
   
   Set lnk = QPR.Document.Links(3) ' 3=TMMK-VEH,4=TMMK-PWT,5=TMMC,6=TMMTX,7=TABC,8=NUMMI,9=TMMI,10=TMMBC,11=TMMAL,12=TMMNK
    
   TimeOut = Now + TimeValue("00:00:05")  '-- wait maximum of 5 seconds
   Do While QPR.Busy Or QPR.readyState <> 4
      DoEvents
      If Now > TimeOut Then
         MsgBox "Time Out after Login"
         Exit Function
      End If
   Loop
   
   lnk.Click
      
End Function
 
Last edited:

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
I have found several errors that I had and think I am closer.
Now I am getting the Invalid qualifier error.

The error refers to this line.
Code:
lnk.click

Code:
Option Compare Database
Option Explicit
Public Function SKPIUPDATE()
Dim QPR As Object
Dim lnk As String
Dim TimeOut As String

' This macro will automatically open and download the TMMK-VEH daily scrap
'and store the file in the same directory

Set QPR = CreateObject("InternetExplorer.application")

    QPR.Visible = True
    
    QPR.navigate "https://www.portal.toyotasupplier.com/wps/myportal/"
    
  TimeOut = Now + TimeValue("00:00:20")  '-- wait maximum of 20 seconds
   Do While QPR.Busy Or QPR.readyState <> 4
      DoEvents
      If Now > TimeOut Then
        MsgBox "Time Out before Login"
        Exit Function
      End If
   Loop

   With QPR.Document.Forms("Login")
      .User.Value = "ggodwin"
      .Password.Value = "060469-9"
      .submit
   End With

   TimeOut = Now + TimeValue("00:00:10")  '-- wait maximum of 10 seconds
   Do While QPR.Busy Or QPR.readyState <> 4
      DoEvents
      If Now > TimeOut Then
         MsgBox "Time Out after Login"
         Exit Function
      End If
   Loop
    QPR.navigate ("https://www.portal.toyotasupplier.com/skpi/")
    
    TimeOut = Now + TimeValue("00:00:10")  '-- wait maximum of 10 seconds
   Do While QPR.Busy Or QPR.readyState <> 4
      DoEvents
      If Now > TimeOut Then
         MsgBox "Did not navigate to SKPI application"
         Exit Function
      End If
   Loop
   
   'QPR.Visible = True
   
   lnk = QPR.Document.Links(3)   ' 3=TMMK-VEH,4=TMMK-PWT,5=TMMC,6=TMMTX,7=TABC,8=NUMMI,9=TMMI,10=TMMBC,11=TMMAL,12=TMMNK
      
   lnk.Click
      
End Function
 
Upvote 0

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

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