我製作了一個將Excel文件讀入Dictionary對象的vbs腳本。當我運行腳本時,它什麼也不做。沒有錯誤消息。VBScript Excel問題
這是代碼:
Set objWords = CreateObject("Scripting.Dictionary")
objWords.CompareMode = 1
CurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(CurPath & "/RE Glossary.xls")
Set objWorksheet = objExcel.ActiveWorkBook.WorkSheets("MG")
intRow = 1
Do Until (objExcel.Cells(intRow, 1).Value) = ""
Value1 = (objExcel.Cells(intRow, 1).Value)
Value2 = (objExcel.Cells(intRow, 2).Value)
objWords.item(Value1) = Value2
Loop
objExcel.Quit
msgbox "There are " & objWords.Count & " words in the glossary."
word = inputbox("word")
if objWords.exists(word) then
msgbox word & vbnewline & "------------" & vbnewline & objWords.item(word)
else
msgbox word & " is not in the glossary."
end if
當你說'它什麼都不做'時,你會看到輸入框和msgboxes? – 2011-09-11 09:38:18