Bonjours
je veux crée un fichier excel qui a comme nom la valeur d'une variable
si on a par exemple une variable (A) qui contient la valeur 2 (A=2) le fichier excel vas donc prendre le nom 2.xls
bon j'ai écrit le code suivant :
le problème maintenant c'est que le fichier excel ne se crée pas
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 Private Sub Command1_Click() Dim xlApp As New Excel.Application Dim xlBook As WorkBook Dim NomFichier As String Dim i As Integer Dim s As String i = 2 Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.WorkBooks.Add s = Val(i) NomFichier = App.Path & s & ".xls" xlBook.SaveAs NomFichier xlBook.Close xlApp.Quit Set xlBook = Nothing Set xlApp = Nothing End Sub
Si quelqu'un à une idée , Merci d'avance .
Partager