Hello, help me
When you apply the save, an error occurs

 Dim c As Integer
        Dim val As String
        If cmbfeuille.Text = "" Then Exit Sub
        xlApp.ScreenUpdating = False
        xlApp.DisplayAlerts = False
        xlWorkBook = xlApp.Workbooks.Open(chemin)
        xlWorkSheet = CType(xlWorkBook.Worksheets(cmbfeuille.Text), Excel.Worksheet)
        For l As Integer = 1 To DataGridView1.RowCount - 1
            For c = 0 To DataGridView1.ColumnCount - 1
                val = CStr(DataGridView1.Rows.Item(l).Cells(c).Value)
                xlWorkSheet.Cells(l + 2, c + 1) = val
            Next c
        Next l
        xlApp.ScreenUpdating = True
        xlApp.DisplayAlerts = True
        modif = False

Recommended Answers

Are you using VB6 ?
Or is this VBA within Excel ?

Jump to Post

All 2 Replies

Time to share what error you saw and what line number since VB's IDE and runtime tells that.

Are you using VB6 ?
Or is this VBA within Excel ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.