0
是我在VBS一個新手,我也很難確定爲什麼這短短的腳本沒有返回的193列數,有一次我會得到正確的計數和其他人,我得到0 預先感謝您的任何和所有的建議。VBScript中不一致的列數
OldCityCat
Sub VerifyOrders
Dim Results
Dim objFSO, objTextFile, objReadFile, Contents, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile("C:\TestFileWith_194_characters.csv")
Set objTextFile = objFSO.OpenTextFile("C:\TestFileWith_194_characters.csv")
Set objReadFile = objFSO.OpenTextFile("C:\TestFileWith_194_characters.csv",1)
objReadFile.ReadAll
Contents = objReadFile.Column -1
WScript.Echo Contents
If Contents < 194 Then
Results = "No Orders"
Else
Results = "Has Orders"
End if
objReadFile.Close
If Results = "No Orders" Then
Call NoOrders
Else
Call OpenAccess
End If
End Sub
'/ If no orders the send email end script. Else If orders process them
Sub NoOrders
If Results = "No Orders" Then
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
objMail.Display
objMail.Recipients.Add ("[email protected]")
objMail.Subject = "No Sales Orders to Process"
objMail.Body = "Respect didn't receive any orders for Pine Castle"
objMail.Send
objOutlook.Quit
Set objMail = Nothing
Set objOutlook = Nothing
End If
End Sub
Sub OpenAccess
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Exec("C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE "&" C:\DropBox\Inflow\DrugSales.accdb /x OnOpen")
WScript.Sleep 60000
WshShell.SendKeys "%{F4}"
End Sub
羅伯特,默認情況下,該文件有194個字符,我想測試,如果更多的數據已經被添加, – OldCityCat
我已經通過,如果加入新行,這似乎是工作的檢查制定了我原來的問題。同樣作爲新手的VBScript但在VBA已編碼了幾年。我有使用Sub的問題。我已經檢查了幾個網上的來源,他們都像VBA,但是當我加分/ End Sub要我的代碼,它不會從我的編輯,沒有錯誤可言運行,只是不運行。刪除Sub/End Sub運行良好。另外我打電話給sub的結果不一致 – OldCityCat