hey guys i need help develop a script to read from a Excel spread sheet. i got it to where it reads from the sheet. the sheet contains my work schedule. i just don't under stand add voice commands and stuff like that. voice command are as the fallowing (do i work today|Do i work tomorrow|do i work on the ##) this what i have so far.
Sub Main
Dim myDateString
myDateString = LongDate
'Determine the day of April 19, 1964
MyDay = Day(myDateString)
'Determine the day today
MyDay = Day(now)+1
Dim xlApp
Dim xlBook
Dim xlSheet
Set xlApp = CreateObject("Excel.Application")
xlApp.visible = False
Set xlBook = xlApp.Workbooks.open("I:\Documents\Data.XLSX")
Set xlSheet = xlBook.Worksheets("WorkSchedule")
if xlSheet.Cells((MyDay), 1).Value = "NA" then
hs.speak ("you dont have work today ")
else
hs.speak ("You have to work today at ") & xlSheet.Cells((MyDay), 1).Value
end if
strComputer = "."
strProcessToKill = "EXCEL.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
End Sub
Thank you for any help
Sub Main
Dim myDateString
myDateString = LongDate
'Determine the day of April 19, 1964
MyDay = Day(myDateString)
'Determine the day today
MyDay = Day(now)+1
Dim xlApp
Dim xlBook
Dim xlSheet
Set xlApp = CreateObject("Excel.Application")
xlApp.visible = False
Set xlBook = xlApp.Workbooks.open("I:\Documents\Data.XLSX")
Set xlSheet = xlBook.Worksheets("WorkSchedule")
if xlSheet.Cells((MyDay), 1).Value = "NA" then
hs.speak ("you dont have work today ")
else
hs.speak ("You have to work today at ") & xlSheet.Cells((MyDay), 1).Value
end if
strComputer = "."
strProcessToKill = "EXCEL.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
count = 0
For Each objProcess in colProcess
objProcess.Terminate()
count = count + 1
Next
End Sub
Thank you for any help
Comment