hexOffender
Programmer
I have an Excel Workbook that gets printed with client name, dob, etc. I just added a second worksheet to the workbook, but how do I write to cells on the second worksheet.
Dim xlApp As New Excel.Application
Dim xlWB As Excel.Workbook = Nothing
Dim Path As String = "Q:\eFormsPrinter\Clinic Encounter Form.xls"
xlWB = xlApp.Workbooks.Open(Path, , )
' Set the value of the Cell
xlApp.Cells(1, 20).value = mstrPatientName
xlApp.Cells(2, 20).value = mstrDOB
xlApp.Cells(3, 20).value = mstrAcct
xlApp.Cells(4, 20).value = mstrMr
xlApp.Cells(5, 20).value = mstrService
xlApp.Cells(6, 20).value = mstrDte
xlApp.Worksheets.PrintOut()
xlWB.Close(False)
xlApp.Workbooks.Close()
xlApp.Quit()
Dim xlApp As New Excel.Application
Dim xlWB As Excel.Workbook = Nothing
Dim Path As String = "Q:\eFormsPrinter\Clinic Encounter Form.xls"
xlWB = xlApp.Workbooks.Open(Path, , )
' Set the value of the Cell
xlApp.Cells(1, 20).value = mstrPatientName
xlApp.Cells(2, 20).value = mstrDOB
xlApp.Cells(3, 20).value = mstrAcct
xlApp.Cells(4, 20).value = mstrMr
xlApp.Cells(5, 20).value = mstrService
xlApp.Cells(6, 20).value = mstrDte
xlApp.Worksheets.PrintOut()
xlWB.Close(False)
xlApp.Workbooks.Close()
xlApp.Quit()