modifica Foglio excel in VBA ACCESS

Di piĆ¹
5 Anni 2 Mesi fa #676 da fabioM1
fabioM1 ha creato la discussione modifica Foglio excel in VBA ACCESS
esempio

Private Sub scheda_Click()
Dim sorgente As String
Dim destinazione As String

Dim xlApp As Object
Dim xlWB As Object
Dim xlWS As Object


sorgente = Application.CurrentProject.Path & "\ModelloR2.xlsx"
destinazione = Application.CurrentProject.Path & "\R2_" & Me.matricola1 & ".xlsx"


FileCopy sorgente, destinazione

Set xlApp = CreateObject("Excel.Application")
'Set xlWB = xlApp.Workbooks.Open(CurrentProject.Path & "\test.xlsx")
Set xlWB = xlApp.Workbooks.Open(destinazione)

Set xlWS = xlWB.Sheets(1)

xlWS.Cells(1, 1) = "TEST ONLY"

xlWB.Save
xlWB.Close

Set xlWS = Nothing
Set xlWB = Nothing
Set xlApp = Nothing

End Sub

Si prega Accedi a partecipare alla conversazione.

Tempo creazione pagina: 0.119 secondi
Powered by Forum Kunena