0% found this document useful (0 votes)
2 views4 pages

Q

question

Uploaded by

Paresh Goel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Q

question

Uploaded by

Paresh Goel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

A rocket is fired from the earth to the moon.

The distance between the earth and the moon is r and the
mass of the earth is 81 times the mass of the moon. The gravitational force on the rocket will be zero,
when its distance from the moon is
(1.) 0.05r
(2.) 0.1r
(3.) 0.02r
(4.) r
(ans.) 2
(topic) Gravitation
(sub-topic) Gravitational potential
(level) 2
(type) numerical
(Q.)


Sub Export2XL()
Dim app As Object
Dim wbk As Object
Dim wsh As Object
Dim option_1_position As Long
Dim option_2_position As Long
Dim option_3_position As Long
Dim option_4_position As Long
Dim ans_position As Long
Dim topic_position As Long
Dim sub_topic_position As Long
Dim level_position As Long
Dim type_position As Long

Dim r As Long
Dim p As Long
Dim n As Long
Dim i As Long
Dim arr As Variant
Dim strLine As String
' Start Excel
On Error Resume Next
Set app = GetObject(Class:="[Link]")
If app Is Nothing Then
Set app = CreateObject(Class:="[Link]")
If app Is Nothing Then
MsgBox "Can't start Excel!", vbExclamation
Exit Sub
End If
End If
'On Error GoTo ErrHandler
' Create workbook with one worksheet
[Link] = True
Set wbk = [Link](Template:=-4167) ' xlWBATWorksheet
Set wsh = [Link](1)
r = 1
[Link](r, 1) = "Question"
[Link](r, 2) = "a"
[Link](r, 3) = "b"
[Link](r, 4) = "c"
[Link](r, 5) = "d"
[Link](r, 6) = "ans"
[Link](r, 7) = "topic"
[Link](r, 8) = "sub topic"
[Link](r, 9) = "level"
[Link](r, 10) = "type"
' Date
strLine = [Link]
'p = InStr(strLine, vbTab)
'strLine = Mid(strLine, p + 1, Len(strLine) - p)
[Link] = "test"
' Loop
'n = [Link]
total_question = Split(strLine, "(Q.)")
n = UBound(total_question)
For i = 0 To n
option_1_position = InStr(1, total_question(i), "(1.)")
[Link](i + 2, 1) = Left(total_question(i), option_1_position)
option_2_position = InStr(1, total_question(i), "(2.)")
[Link](i + 2, 2) = Mid(total_question(i), option_1_position + 1, option_2_position)
option_2_position = InStr(1, total_question(i), "(2.)")
[Link](i + 2, 3) = Mid(total_question(i), option_1_position + 1, option_2_position)
option_3_position = InStr(1, total_question(i), "(3.)")
[Link](i + 2, 4) = Mid(total_question(i), option_2_position + 1, option_3_position)
option_4_position = InStr(1, total_question(i), "(4.)")
[Link](i + 2, 5) = Mid(total_question(i), option_3_position + 1, option_4_position)
ans_position = InStr(1, total_question(i), "(ans.)")
[Link](i + 2, 6) = Mid(total_question(i), option_4_position + 1, ans_position)
topic_position = InStr(1, total_question(i), "(topic)")
[Link](i + 2, 7) = Mid(total_question(i), ans_position + 1, topic_position)
sub_topic_position = InStr(1, total_question(i), "(sub-topic)")
[Link](i + 2, 8) = Mid(total_question(i), topic_position + 1, sub_topic_position)
level_position = InStr(1, total_question(i), "(level)")
[Link](i + 2, 9) = Mid(total_question(i), sub_topic_position + 1, level_position)
type_position = InStr(1, total_question(i), "(type)")
[Link](i + 2, 10) = Right(total_question(i), type_position)

Next i



End Sub

You might also like