AnsweredAssumed Answered

E5071C Close Excel & Range question?

Question asked by ethan1208g@yahoo.com.tw on Jan 26, 2014
Latest reply on Feb 15, 2014 by sdeyoreo
Sorry about my poor english,i'll do my best to explan my question.

i try to open excel file and write something in it just as below

Dim workbook
Set workbook = CreateObject("Excel.Application")
workbook.Workbooks.OPEN "d:\test.xls", , True
workbook.Visible = True
workbook.quit

can i use button2 to close workbook?
everytime i move workbook.quit under button2_click,it doesn't work

the other question is when i use range it will show "sub or funtion not define". is that means i can't use range in E5071C?
Can somebody help me? Thanks very much!!!!

My program as below


Sub CommandButton1_Click()

Dim workbook
Set workbook = CreateObject("Excel.Application")
workbook.Workbooks.OPEN "d:\test.xls", , True
workbook.Visible = True


SCPI.CALCulate(2).PARameter(1).SELect
X_val = SCPI.CALCulate(2).SELected.MARKer(1).X
SCPI.CALCulate(2).PARameter(4).SELect
X_vall = SCPI.CALCulate(2).SELected.MARKer(5).X
SCPI.CALCulate(2).PARameter(5).SELect
Scc21_100MHz = SCPI.CALCulate(2).SELected.MARKer(1).Y
SCPI.CALCulate(2).PARameter(5).SELect
Scc21_1GHz = SCPI.CALCulate(2).SELected.MARKer(2).Y
SCPI.CALCulate(2).PARameter(5).SELect
Scc21_L = SCPI.CALCulate(2).SELected.MARKer(3).X
SCPI.CALCulate(2).PARameter(5).SELect
Scc21_R = SCPI.CALCulate(2).SELected.MARKer(4).X
SCPI.CALCulate(2).PARameter(2).SELect
Zcm_100MHz = SCPI.CALCulate(2).SELected.MARKer(1).Y
SCPI.CALCulate(2).PARameter(2).SELect
Zcm_1GHz = SCPI.CALCulate(2).SELected.MARKer(2).Y
SCPI.CALCulate(2).PARameter(6).SELect
Zdm_100MHz = SCPI.CALCulate(2).SELected.MARKer(1).Y
SCPI.CALCulate(2).PARameter(6).SELect
Zdm_1GHz = SCPI.CALCulate(2).SELected.MARKer(2).Y
SCPI.CALCulate(2).PARameter(3).SELect
Zc_100MHz = SCPI.CALCulate(2).SELected.MARKer(1).Y
SCPI.CALCulate(2).PARameter(3).SELect
Zc_1GHz = SCPI.CALCulate(2).SELected.MARKer(2).Y

'show  value
RANGe("A" & 1) = "11"
RANGe("B" & 1) = "22"

End Sub


'exit
Private Sub CommandButton2_Click()

workbook.quit

End

End Sub


'delete data----------------------
Private Sub CommandButton3_Click()

Dim KillFile As String
On Error Resume Next
Kill "d:\E5071C getdata.txt"
If Dir("d:\E5071C getdata.txt") = "" Then MsgBox "File already deleted"


End Sub  

Outcomes