New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Apps and Games Discussion of applications and games available for Mac OS X.

script problem excel


Post Reply New Thread Subscribe

 
Thread Tools
f.bongers

 
Member Since: Jul 14, 2011
Posts: 2
f.bongers is on a distinguished road

f.bongers is offline
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
objWorksheet.Delete
End If
Next

Set objIE = CreateObject("InternetExplorer.Application") 'maak verbinding met internet explorer
objIE.Navigate "http://www.letour.fr/" & 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
DoEvents
Loop

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
Do
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
Next
.Rows(1).Delete 'verwijder eerste rij (individual points team climber youth)
.Columns("A:F").AutoFit 'automatisch kolombreedte
End With
Next
Next

objIE.Quit

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.
QUOTE Thanks
SJTV1

 
Member Since: Feb 23, 2008
Posts: 86
SJTV1 is an unknown at this point
Mac Specs: 15,4" MBP 2,4 GHz, 2MB RAM, 250 GB HDD (Seagate aftermarket), Leopard, Logitech V470.

SJTV1 is offline
Which office for mac are you using?
QUOTE Thanks
f.bongers

 
Member Since: Jul 14, 2011
Posts: 2
f.bongers is on a distinguished road

f.bongers is offline
I am using Office 2011
QUOTE Thanks

Post Reply New Thread Subscribe


« Firefox automatically downloads after prompts | Time Machine »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Problem with Excel 2011 for Mac Deckhand OS X - Apps and Games 2 05-29-2011 09:40 PM
Weird internet script viewing problem.. Please help gambit3678 OS X - Operating System 4 03-26-2011 11:20 AM
Problem with launching x11 applications kousik OS X - Development and Darwin 8 11-19-2009 12:42 AM
need help to amend a script so that it only runs if iTunes is running nick_harambee OS X - Operating System 1 07-20-2009 11:15 AM
Convert Excel VB script to Applescript? pingwin77 OS X - Apps and Games 1 07-03-2008 11:30 AM

All times are GMT -4. The time now is 06:55 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?