I am currently creating an ASP.NET/VB web system that manipulates an Excel file as part of it's functionality. This excel file contains multiple combo boxes, text boxes and labels that need to be edited, as well as certain cells.
When trying to edit any of the "form fields" - the labels, text boxes and combo boxes - I get the following error.
Public member 'comboOrderedBy' on type 'Worksheet' not found.
This appears on the line
xlWorkSheet.comboOrderedBy.Text = OrderedBy.Text
What is causing this? This error only appears when running the system from the server - when I run it using a local host (Visual Studios built in debugger), it works fine.
The code for this section is;
Dim xlApp As Excel.Application
Dim xlWorkBook As Excel.Workbook
Dim xlWorkSheet As Excel.Worksheet
xlApp = New Excel.Application
xlWorkBook = xlApp.Workbooks.Open("C:\Testing\BAndQCardSubmissionsTemplate.xlsx")
xlWorkSheet = xlWorkBook.Worksheets("Card Order Details")
xlWorkSheet.comboOrderedBy.Text = OrderedBy.Text
xlWorkSheet.txtcustref = CustomerRef.Text
xlWorkSheet.frm_txt_CustRef.Text = CustomerRef.Text
xlWorkSheet.Cells(8, 4) = CardNo1Label.Text & CheckDigit1Label.Text.Trim()
xlWorkSheet.Cells(8, 5) = Value1Label.Text
xlWorkSheet.Cells(8, 6) = PropRef1Label.Text
xlWorkSheet.Cells(8, 7) = NewLetName1Label.Text & RepairName1Label.Text
xlWorkSheet.Cells(8, 8) = NewLetOrRep1Label.Text
xlWorkSheet.Cells(8, 9) = Concatenation1.Text
Dim FileDate As String = SysdateTextBox.Text
FileDate = FileDate.Replace(" ", "")
FileDate = FileDate.Replace("/", "")
FileDate = FileDate.Replace(":", "")
xlWorkBook.SaveAs("C:\Testing\BAndQCardSubmission" & FileDate & ".xlsx")
xlWorkBook.Close(True)
xlApp.Quit()
This was fixed when I instead decided to add the data into some other cells, and then create a Macro that ran in order to grab the information from the cells and place them in the form fields.