Clear code and export Excel code

Clear code:

    Dim ctl As Control
    'Remove all text box contents
    For Each ctl In Controls
        If TypeOf ctl Is TextBox Then ctl.Text = ""
    Next ctl
    'Remove all combobox text box contents
    For Each ctl In Controls
        If TypeOf ctl Is ComboBox Then ctl. Text = ""
    Next ctl

Export Excel code:

    Dim xlApp As Excel.Application
    Dim xlBpp As Excel.Workbook
    Dim xlSheet As Excel.Worksheet
    
    Set xlApp = New Excel.Application 'Create a reference to
    xlApp Set xlApp = CreateObject("Excel.application") 'Create an Excel object
    Set xlBook = xlApp. Workbooks.Add 'Add workbook
    xlApp.SheetsInNewWorkbook = 1 'Set the number of open worksheets
    xlApp.Visible = True 'Set Excel visible
    xlApp.Caption = "Charge amount"
    xlApp.ActiveSheet.Cells(i, j).Value = "" 'Assign a value to a cell in the active worksheet

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325688027&siteId=291194637