I am new to VBscripting. I had a script under vb which worked but i have mosified it to run under vbscripting but to no avial. here is the vb script (some variables set as constants to run in a test mode from a dos prompt,
ie. c:\wscript.exe c:\directory\scriptname.vbs
i Have beed trying it for soem time but now i dont even get adn error messages it appears to work but does not save the word document. Email No2Reflux@hotmail.com if you need mor info on what i need from the script her is the script feel free to mark it in red and email me back directly....
Dim workordernum
Dim roomnum
Dim repairnum
Dim employeenum
Sub Fill_workordernum()
workordernum = "5555555"
End Sub
Sub Fill_roomnum()
roomnum = "200"
End Sub
Sub Fill_repairnum()
repairnum = "10010"
End Sub
Sub Fill_employeenum()
employeenum = "101"
End Sub
Sub WorkOrderPrint()
Dim oWord
Dim WorkDir
Dim worknum
Dim i
Dim j
Dim k
Dim m
Dim workordernumber
Dim roomnumber
Dim repairnumber
Dim employeenumber
' Assign working directory
WorkDir = "C:\Program Files\VoiceGuide\Scripts\roomtalk\docs\"
' Fill in Work order information
Call Fill_workordernum
Call Fill_roomnum
Call Fill_repairnum
Call Fill_employeenum
Set oWord = CreateObject("Word.Application"
' Opens Invoice Template file
.documents.Open ("C:\Program Files\VoiceGuide\Scripts\roomtalk\docs\printedworkorder.doc"
' Print work order number Information
.ActiveDocument.Bookmarks("workordernum".Select
workordernumber = workordernum
.Selection.Typetext workordernumber
' Print room number Information
.ActiveDocument.Bookmarks("roomnum".Select
roomnumber = roomnum
.Selection.Typetext roomnumber
' Print repair code number Information
.ActiveDocument.Bookmarks("repairnum".Select
repairnumber = repairnum
.Selection.Typetext repairnumber
' Print employee number Information
.ActiveDocument.Bookmarks("employeenum".Select
employeenumber = employeenum
.Selection.Typetext employeenumber
' Print repair code text decription 'Information-not active now
' Create name for Invoice
worknum = WorkDir & "workordernum" & ".doc"
' Saves the Word document
.ActiveDocument.SaveAs (worknum)
' Quits Word Application
.Quit
Set oWord = Nothing
End Sub
ie. c:\wscript.exe c:\directory\scriptname.vbs
i Have beed trying it for soem time but now i dont even get adn error messages it appears to work but does not save the word document. Email No2Reflux@hotmail.com if you need mor info on what i need from the script her is the script feel free to mark it in red and email me back directly....
Dim workordernum
Dim roomnum
Dim repairnum
Dim employeenum
Sub Fill_workordernum()
workordernum = "5555555"
End Sub
Sub Fill_roomnum()
roomnum = "200"
End Sub
Sub Fill_repairnum()
repairnum = "10010"
End Sub
Sub Fill_employeenum()
employeenum = "101"
End Sub
Sub WorkOrderPrint()
Dim oWord
Dim WorkDir
Dim worknum
Dim i
Dim j
Dim k
Dim m
Dim workordernumber
Dim roomnumber
Dim repairnumber
Dim employeenumber
' Assign working directory
WorkDir = "C:\Program Files\VoiceGuide\Scripts\roomtalk\docs\"
' Fill in Work order information
Call Fill_workordernum
Call Fill_roomnum
Call Fill_repairnum
Call Fill_employeenum
Set oWord = CreateObject("Word.Application"
' Opens Invoice Template file
.documents.Open ("C:\Program Files\VoiceGuide\Scripts\roomtalk\docs\printedworkorder.doc"
' Print work order number Information
.ActiveDocument.Bookmarks("workordernum".Select
workordernumber = workordernum
.Selection.Typetext workordernumber
' Print room number Information
.ActiveDocument.Bookmarks("roomnum".Select
roomnumber = roomnum
.Selection.Typetext roomnumber
' Print repair code number Information
.ActiveDocument.Bookmarks("repairnum".Select
repairnumber = repairnum
.Selection.Typetext repairnumber
' Print employee number Information
.ActiveDocument.Bookmarks("employeenum".Select
employeenumber = employeenum
.Selection.Typetext employeenumber
' Print repair code text decription 'Information-not active now
' Create name for Invoice
worknum = WorkDir & "workordernum" & ".doc"
' Saves the Word document
.ActiveDocument.SaveAs (worknum)
' Quits Word Application
.Quit
Set oWord = Nothing
End Sub