[code]
VBSTART
Public intRow
Public celwaarde_oud
Public m1
Public m2
Public m3
Public m4
Public m5
Public m6
Public m7
Public m8
Public m9
Public o1
Public o2
Public o3
Public o4
Public o5
Public o6
Public o7
Public o8
Public o9
Public o10
Public fn
Public er
Public knr
Public enr
Public oud
Public waarde
Sub Macro1(fn, er, knr, enr, m1, q1, m2, q2, m3, q3, m4, q4, m5, q5, m6, q6, m7, q7, m8, q8, m9, q9, m10, q10)
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open (fn)
objExcel.Visible = True
If (m1 "") Then m1 = m1 * 2
If (m2 "") Then m2 = m2 * 2
If (m3 "") Then m3 = m3 * 2
If (m4 "") Then m4 = m4 * 2
If (m5 "") Then m2 = m5 * 2
If (m6 "") Then m6 = m6 * 2
If (m7 "") Then m7 = m7 * 2
If (m8 "") Then m8 = m8 * 2
If (m9 "") Then m9 = m9 * 2
If (m10 "") Then m10 = m10 * 2
intRow = er
Do Until objExcel.Cells(intRow, knr).Value = ""
oud = objExcel.Cells(intRow, knr).Value
waarde = oud - enr
If (waarde Macro1,fn,er,knr,enr,m1,q1,m2,q2,m3,q3,m4,q4,m5,q5,m6,q6,m7,q7,m8,q8,m9,q9,m10,q10
[/code]
Why doesnt this work?
Error in VB script
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
I haven't looked at the VBScript block but the rest of your code should be:
Code: Select all
Let>fn=C:\Documents and Settings\Zef\Bureaublad\Impedance Spectrometry txts par tabel TEST.xls
Let>er=3
Let>knr=3
Let>enr=1000
Let>m1=40
Let>m2=80
Let>m3=120
Let>m4=1000
Let>q1=testing
Let>q2=2
Let>q3=3
Let>q4=ssd
VBRun>Macro1,fn,er,knr,enr,m1,q1,m2,q2,m3,q3,m4,q4,m5,q5,m6,q6,m7,q7,m8,q8,m9,q9,m10,q10
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Ok thanks, it works a lot better
with some MsgBoxes i found out where the VB bugs are.
knr, intRow and enr all have a value.
m1,m2,m3,m4 q1,q2,q3,q4 all have a value.
but if the value of m5 = "NULL" then it wont be higher then the value in the Excell cell.
Everything works untill here:
with some MsgBoxes i found out where the VB bugs are.
knr, intRow and enr all have a value.
m1,m2,m3,m4 q1,q2,q3,q4 all have a value.
but if the value of m5 = "NULL" then it wont be higher then the value in the Excell cell.
Everything works untill here:
Do Until objExcel.Cells(intRow, knr).Value = ""
celvalue= objExcel.Cells(intRow, knr).Value
waarde = celvalue - enr
If (waarde<m1) Then
objExcel.Cells(intRow, 10).Value = q1
ElseIf (waarde<m2) Then
objExcel.Cells(intRow, 10).Value = q2
ElseIf (waarde<m3) Then
objExcel.Cells(intRow, 10).Value = q3
ElseIf (waarde<m4) Then
objExcel.Cells(intRow, 10).Value = q4
ElseIf (waarde<m5) Then
objExcel.Cells(intRow, 10).Value = q5
ElseIf (waarde<m6) Then
objExcel.Cells(intRow, 10).Value = q6
ElseIf (waarde<m7) Then
objExcel.Cells(intRow, 10).Value = q7
ElseIf (waarde<m8) Then
objExcel.Cells(intRow, 10).Value = q8
ElseIf (waarde<m9) Then
objExcel.Cells(intRow, 10).Value = q9
ElseIf (waarde<m10) Then
objExcel.Cells(intRow, 10).Value = q10
Else
objExcel.Cells(intRow, 10).Value = "Unknown"
End If
intRow = intRow + 1
Loop
Last edited by Knoore on Fri Dec 15, 2006 9:52 am, edited 1 time in total.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Doesn't look like you have set intRow to anything.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?