Chris van der Berg
Member
I am totally new to VBA codes, and would like help with the following code:
What I try to achieve:
1. I want to copy the Bible, all Books and verses to excel (One Book at a time)
2. From url www.bybel.co.za
3. Use an input field to select the Bible Book ie. Genesis
4. The VBA code should then select the Book ie. Genesis and copy all verses to excel
5. This is a code I came up with, but needless to say it does not give me the information I want:
Sub GetBibleText()
Dim URL As String
Dim Data As String
Dim mybook As String
Dim Mytext As String
mybook = InputBox("Enter Book")
mytext = InputBox("Enter From text no.")
URL = "www.bybel.co.za/search/search-detail.php?prev=-2&book=(mybook)&chapter=(mytext)&version=1&GO=Wys"
Dim ie As Object
Dim ieDoc As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate URL
Do Until (ie.readyState = 4 And Not ie.Busy)
DoEvents
Loop
Set ieDoc = ie.Document
Data = ieDoc.body.innerText
'Split Data into separate lines
'or just use Range("A1")=data
Dim myarray As Variant
myarray = Split(Data, vbCrLf)
For i = 0 To UBound(myarray)
'Start writing in cell A1
Cells(i + 1, 1) = myarray(i)
Next
ie.Quit
Set ie = Nothing
Set ieDoc = Nothing
End Sub
Can someone please help
Regards
Chris
What I try to achieve:
1. I want to copy the Bible, all Books and verses to excel (One Book at a time)
2. From url www.bybel.co.za
3. Use an input field to select the Bible Book ie. Genesis
4. The VBA code should then select the Book ie. Genesis and copy all verses to excel
5. This is a code I came up with, but needless to say it does not give me the information I want:
Sub GetBibleText()
Dim URL As String
Dim Data As String
Dim mybook As String
Dim Mytext As String
mybook = InputBox("Enter Book")
mytext = InputBox("Enter From text no.")
URL = "www.bybel.co.za/search/search-detail.php?prev=-2&book=(mybook)&chapter=(mytext)&version=1&GO=Wys"
Dim ie As Object
Dim ieDoc As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate URL
Do Until (ie.readyState = 4 And Not ie.Busy)
DoEvents
Loop
Set ieDoc = ie.Document
Data = ieDoc.body.innerText
'Split Data into separate lines
'or just use Range("A1")=data
Dim myarray As Variant
myarray = Split(Data, vbCrLf)
For i = 0 To UBound(myarray)
'Start writing in cell A1
Cells(i + 1, 1) = myarray(i)
Next
ie.Quit
Set ie = Nothing
Set ieDoc = Nothing
End Sub
Can someone please help
Regards
Chris