Fichier excel vb.net

Résolu
gatoune78 Messages postés 42 Date d'inscription   Statut Membre Dernière intervention   -  
 Stev28fr -
Bonjour,

j'effectue un petit programme pour pouvoir enregistrer des données au sein d'un fichier excel
tout fonctionne super bien!

cependant, j'aimerai bien pouvoir afficher la page un fois que mon application est terminée, mais je n'y arrive pas, malgré plusieurs recherches sur la toile.

voici quelques lignes de code pour vous aider à m'aider :

appExcel = CreateObject("Excel.Application")
wbExcel = appExcel.Workbooks.Add
wsExcel = wbExcel.Worksheets(1)
wbExcel.SaveAs("toto.xls")

je ne vous ai pas mis l'insertion au sein du fichier mais tout fonctionne!

Merci d'avance

A voir également:

2 réponses

Utilisateur anonyme
 
Bonjour,

Exemple type :

Private Sub btn_CreerFichier_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_CreerFichier.Click

	Dim appExcel As New Excel.Application
	Dim wbExcel As Excel.Workbook
	Dim wsExcel As Excel.Worksheet
	Dim CheminFichier As String = "C:\Document\"
	Dim CheminAcces As String = String.Empty

	appExcel = New Excel.Application
	wbExcel = appExcel.Workbooks.Add
	wsExcel = DirectCast(wbExcel.Worksheets(1), Excel.Worksheet)

	wsExcel.Range("A1").Value = "Lupin"

	CheminAcces = String.Format("{0}{1}", CheminFichier, "Essai.xls")

	wbExcel.SaveAs(CheminAcces)

	appExcel.Visible = True

	'wbExcel.Close()
	'appExcel.Quit()

	MessageBox.Show("Fichier créé", "Création", MessageBoxButtons.OK, MessageBoxIcon.Information)

End Sub


Cdt

Lupin
4
gatoune78 Messages postés 42 Date d'inscription   Statut Membre Dernière intervention  
 
Merci Beaucoup!
0
Xineroks Messages postés 158 Date d'inscription   Statut Membre Dernière intervention   3
 
Merci pour ce code, j'en avais besoin aussi !
0
Stev28fr
 
Bonjour,
Moi j'ai un petite problème c'est qu'il me souligne en tant qu'erreur
Excel.Application 
Excel.Worbook
Excel.Worksheet

Pouvez vous m'aider ? :)

Merci
0