Results 1 to 3 of 3
  1. #1

    Member Since
    Jul 14, 2011
    script problem excel
    I have an excelsheet with the foolowing script but it doesn't work on a mac.
    Option Explicit

    Private Sub CommandButton1_Click()

    Dim clngvbNullString As Long
    Dim avntJersey As Variant
    Dim avntStanding As Variant
    Dim avntStage As Variant
    Dim iavntJersey As Long
    Dim iavntStanding As Long
    Dim iavntStage As Long
    Dim lngCol As Long
    Dim lngRow As Long
    Dim objHTML1 As Object
    Dim objHTML2 As Object
    Dim objIE As Object
    Dim objWorksheet As Object
    Dim strStage As String

    With Application
    .Calculation = xlCalculationManual
    .DisplayAlerts = False
    .ScreenUpdating = False
    End With

    avntStanding = Array("G", "Algemeen", "E", "Etappe") 'id's in html-broncode en tab-namen
    avntJersey = Array("IT", "Individueel", "IP", "Punten", "ET", "Ploegen", "IM", "Berg", "IJ", "Jongeren") 'id's in html-broncode en tab-namen

    For Each objWorksheet In Worksheets 'wis alle bladen behalve "Invoer"
    If objWorksheet.Name <> "Invoer" Then
    End If

    Set objIE = CreateObject("InternetExplorer.Application") 'maak verbinding met internet explorer
    objIE.Navigate "" & CStr(Range("C2").Value) & "/TDF/LIVE/us/" & CStr(100 * Range("C3").Value) & "/classement/index.html" 'maak verbinding met website
    objIE.Visible = True 'maak internet explorer zichtbaar
    Do While objIE.Busy Or objIE.readyState <> 4 'wacht tot internet explorer klaar is

    Set objHTML1 = objIE.document 'lees document
    For iavntStanding = 0 To UBound(avntStanding) Step 2 'doorloop rangschikkingen
    objHTML1.getElementbyid(avntStanding(iavntStanding )).Click 'klik rangschikking
    Application.Wait (Now + TimeValue("0:00:0" & Range("C4").Value)) 'wacht
    Set objHTML2 = objHTML1.getElementbyid("detailDiv").document 'lees document
    For iavntJersey = 0 To UBound(avntJersey) Step 2 'doorloop trui
    objHTML2.getElementbyid(avntJersey(iavntJersey)).C lick 'klik trui
    Application.Wait (Now + TimeValue("0:00:0" & Range("C4").Value)) 'wacht
    strStage = objHTML1.getElementbyid("contentDetailDyn").innert ext 'lees text in html-broncode
    Loop Until strStage <> vbNullString And strStage <> "Loading..." 'niet leeg en niet "Loading"
    avntStage = Split(strStage, vbCrLf) 'opdelen
    With Worksheets.Add(, Worksheets(Worksheets.Count)) 'voeg tabblad toe
    .Name = avntStanding(iavntStanding + 1) & "_" & avntJersey(iavntJersey + 1) 'stel naam van tabblad in
    lngRow = 1 'rij am_2011
    lngCol = 0 'kolom
    clngvbNullString = 0 'aantal lege regels na elkaar
    For iavntStage = 0 To UBound(avntStage) 'doorloop text
    Select Case avntStage(iavntStage)
    Case Is = "<div class='errormess'><activez_javascript:></div>" 'einde (sub)tabel
    lngRow = lngRow + 1 'volgende rij
    lngCol = 0 'kolom
    Case Is <> vbNullString
    lngCol = lngCol + 1 'volgende kolom
    .Cells(lngRow, lngCol).Value = avntStage(iavntStage) 'schrijf data
    clngvbNullString = 0 'aantal lege regels na elkaar
    Case Is = vbNullString
    clngvbNullString = clngvbNullString + 1 'aantal lege regels na elkaar
    End Select
    If clngvbNullString = 3 Then 'wanneer het aantal lege regels na elkaar 3 is, is de rij kompleet
    lngRow = lngRow + 1 'volgende rij
    lngCol = 0 'kolom
    clngvbNullString = 0 'aantal lege regels na elkaar
    End If
    .Rows(1).Delete 'verwijder eerste rij (individual points team climber youth)
    .Columns("A:F").AutoFit 'automatisch kolombreedte
    End With


    Set objWorksheet = Nothing
    Set objHTML2 = Nothing
    Set objHTML1 = Nothing
    Set objIE = Nothing

    With Application
    .Calculation = xlCalculationAutomatic
    .DisplayAlerts = True
    .ScreenUpdating = True
    End With

    End Sub

    Can anyone tell me what is wrong with this script so that i can fix it.

  2. #2

    Member Since
    Feb 23, 2008
    15,4" MBP 2,4 GHz, 2MB RAM, 250 GB HDD (Seagate aftermarket), Leopard, Logitech V470.
    Which office for mac are you using?

  3. #3

    Member Since
    Jul 14, 2011
    I am using Office 2011

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Weird internet script viewing problem.. Please help
    By gambit3678 in forum macOS - Operating System
    Replies: 4
    Last Post: 03-26-2011, 11:20 AM
  2. Terminal -- shell script -- script will only read two lines of a file
    By Straitsfan in forum macOS - Apps and Games
    Replies: 0
    Last Post: 01-30-2011, 09:04 PM
  3. Convert Excel VB script to Applescript?
    By pingwin77 in forum macOS - Apps and Games
    Replies: 1
    Last Post: 07-03-2008, 11:30 AM
  4. iCal script running problem
    By goobimama in forum macOS - Operating System
    Replies: 0
    Last Post: 12-05-2007, 11:12 AM
  5. Shells script problem
    By Mbengi Bongi in forum macOS - Development and Darwin
    Replies: 1
    Last Post: 10-24-2007, 12:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts