Hello all! And thanks in advance for your help.
I am a rather new developer with VB6. I currently have a program that measures the current output from a meter every 3 seconds. I want to export the exact time of the measurement, along with the measurement itself, into an Excel spreadsheet. I want it to add each new measurement in a new row.
Basically, I have it working to an extent. The program does the measurement, opens a spreadsheet (a new one each day), and then exports that data out. Currently I have it set up to find the first empty row and enter the data this way:
oSheet.Range("A" & Rows.count).End(xlUp).offset(1).Value = time
oSheet.Range("B" & Rows.count).End(xlUp).offset(1).Value = txtMeasurementResults.Text
This works on the first measurement. However, once the program does the second measurement (3 seconds later) I get a runtime error "1004": Method Rows of object '_Global' failed. This error is set at the first line above (the range line for column A).
Any idea what I've done wrong?
Also, since I'm getting a new measurement every 3 seconds, is there an efficient way to store all that data and dump it at one time instead of saving it to the spreadsheet over and over again?
Thanks again!
I am a rather new developer with VB6. I currently have a program that measures the current output from a meter every 3 seconds. I want to export the exact time of the measurement, along with the measurement itself, into an Excel spreadsheet. I want it to add each new measurement in a new row.
Basically, I have it working to an extent. The program does the measurement, opens a spreadsheet (a new one each day), and then exports that data out. Currently I have it set up to find the first empty row and enter the data this way:
oSheet.Range("A" & Rows.count).End(xlUp).offset(1).Value = time
oSheet.Range("B" & Rows.count).End(xlUp).offset(1).Value = txtMeasurementResults.Text
This works on the first measurement. However, once the program does the second measurement (3 seconds later) I get a runtime error "1004": Method Rows of object '_Global' failed. This error is set at the first line above (the range line for column A).
Any idea what I've done wrong?
Also, since I'm getting a new measurement every 3 seconds, is there an efficient way to store all that data and dump it at one time instead of saving it to the spreadsheet over and over again?
Thanks again!