Sub text_word() Dim oWord As Word.Application 'Créer une instance de word Set oWord = CreateObject("Word.Application") oWord.Documents.Open ("chemin document.doc") 'chemin du fichier doc oWord.ShowMe 'rendre le document word visible oWord.Visible = True 'code pour les différentes opérations With oWord.Selection .TypeText Text:=[A1] & ", " .Font.Size = 18 .Font.Name = "Tahoma" .ParagraphFormat.Alignment = wdAlignParagraphCenter End With End Sub
.TypeText Text:=[A1] & ", "
.TypeText Text:="mettre le texte"
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question'cochez la référence Microsoft Word 11.0 Object Library Private Sub CommandButton1_Click() text_word_1 text_word_2 End Sub Sub text_word_1() Dim oWord As Word.Application 'Créer une instance de word Set oWord = CreateObject("Word.Application") oWord.Documents.Open ("C:\Documents and Settings\Propriétaire\Mes documents\essai.doc") 'chemin du fichier doc oWord.ShowMe 'rendre le document word visible oWord.Visible = True 'code pour les différentes opérations With oWord.Selection .TypeText Text:="texte essai_1" .Font.Size = 18 .Font.Name = "Tahoma" .ParagraphFormat.Alignment = wdAlignParagraphCenter End With oWord.Quit End Sub Sub text_word_2() Dim oWord As Word.Application 'Créer une instance de word Set oWord = CreateObject("Word.Application") oWord.Documents.Open ("C:\Documents and Settings\Propriétaire\Mes documents\essai_2.doc") 'chemin du fichier doc oWord.ShowMe 'rendre le document word visible oWord.Visible = True 'code pour les différentes opérations With oWord.Selection .TypeText Text:="texte essai_2" .Font.Size = 18 .Font.Name = "Tahoma" .ParagraphFormat.Alignment = wdAlignParagraphCenter End With oWord.Quit End Sub
.Font.Size = 18 .Font.Name = "Tahoma" .TypeText Text:="texte essai_1"
Dim WordApp As Word.Application Dim WordDoc As Word.Document Set WordApp = CreateObject("word.application") WordApp.Visible = True Set un_doc = WordApp.Documents.Add Set aut_doc = WordApp.Documents.Add un_doc.Content.Select With WordApp.Selection .Text = "un texte à ajouter dans un_doc " .Font.Name = "Tahoma" .Font.Size = 18 '.Paragraphs.Last.Range.Select .MoveRight .Text = "une suite à ajouter dans un_doc" .Font.Bold = True .Font.Size = 10 End With aut_doc.Content.Select With WordApp.Selection .Text = "un texte à ajouter dans aut_doc" .Font.Name = "Tahoma" .Font.Size = 10 '.Paragraphs.Last.Range.Select .MoveRight .Text = "une suite à ajouter dans aut_doc" .Font.Bold = True .Font.Size = 18 End With
Dim un_Doc As Word.Document Dim aut_Doc As Word.Document
Dim WordDoc As Word.Document