Hello, Everyone!
Why doesn't the following code work on the attached template sheet?
Code: Select all
Sub ReadNSaveDialog1 ()
cxtx_TextField1 = oDialog1.GetControl("cxtx_TextField1")
cxcb_ComboBox1 = oDialog1.GetControl("cxcb_ComboBox1")
cpdt_cpdt_DateField1 = oDialog1.GetControl("cpdt_DateField1")
cxtx_TextField2 = oDialog1.GetControl("cxtx_TextField2")
cxtx_TextField3 = oDialog1.GetControl("cxtx_TextField3")
cxtx_TextField4 = oDialog1.GetControl("cxtx_TextField4")
cpdt_DateField2 = oDialog1.GetControl("cpdt_DateField2")
cpdt_DateField3 = oDialog1.GetControl("cpdt_DateField3")
cxcb_ComboBox2 = oDialog1.GetControl("cxcb_ComboBox2")
cxcb_ComboBox3 = oDialog1.GetControl("cxcb_ComboBox3")
lastrow = Bt_Ok()
ThisComponent.Sheets(0).getCellByPosition(0, lastrow).setString( cxtx_TextField1.Text)
ThisComponent.Sheets(0).getCellByPosition(1, lastrow).setString( cxcb_ComboBox1.Text)
ThisComponent.Sheets(0).getCellByPosition(2, lastrow).setValue(CDate(cpdt_DateField1.Model.Text))
ThisComponent.Sheets(0).getCellByPosition(3, lastrow).setString( cxtx_TextField2.Text)
ThisComponent.Sheets(0).getCellByPosition(4, lastrow).setString( cxtx_TextField3.Text)
ThisComponent.Sheets(0).getCellByPosition(5, lastrow).setString( cxtx_TextField4.Text)
ThisComponent.Sheets(0).getCellByPosition(6, lastrow).setValue(CDate(cpdt_DateField2.Model.Text))
ThisComponent.Sheets(0).getCellByPosition(7, lastrow).setValue(CDate(cpdt_DateField3.Model.Text))
ThisComponent.Sheets(0).getCellByPosition(8, lastrow).setString( cxcb_ComboBox2.Text)
ThisComponent.Sheets(0).getCellByPosition(9, lastrow).setString( cxcb_ComboBox3.Text)
cxtx_TextField1.Text = ""
cxcb_ComboBox1.Text = ""
cpdt_cpdt_DateField1.Model.Text = ""
cxtx_TextField2.Text = ""
cxtx_TextField3.Text = ""
cxtx_TextField4.Text = ""
cpdt_DateField2.Model.Text = ""
cpdt_DateField3.Model.Text = ""
cxcb_ComboBox2.Text = ""
cxcb_ComboBox3.Text = ""
End Sub
I would also like to:
1) Show selection list in Label2, Label9 and Label10, as a data validation that I will add in columns L, N and P;
2) Transfer the data to the spreadsheet on the line where the cursor is stopped (without automatic line change),
preserving the formatting in the table and keeping the form open with the transferred data.
Grateful for the attention!
Orlando Souza
