Aprire Microsoft Office Word 2007 , fare clic sulla scheda "Sviluppatore " e selezionare " Visual Basic ". Selezionare il menu "Inserisci" e selezionare 
 2 
 Digitare quanto segue per creare un nuovo sottoprogramma "Modulo ". : 
 
Private Sub useVBinWord ( ) per
 Press " inserire " 
 3 
 Digitare il seguente per inserire due righe di testo : 
 
 Selection.TypeText text : =" . sto inserendo il testo di questo documento di Word . " 
 
 Selection.TypeParagraph 
 
 Selection.TypeText Text : =" ho anche intenzione di inserire questa tabella : " 
 
 
 Selection.TypeParagraph 
 4 
 Digitare quanto segue per inserire una tabella con quattro colonne e quattro righe : 
 
 ActiveDocument.Tables.Add Range: = Selection.Range , NumRows : = 4 , NumColumns : = _ 
 
 4 , DefaultTableBehavior : = wdWord9TableBehavior , AutoFitBehavior : . = _ 
 
 wdAutoFitFixed 
 
Selection.Tables ( 1 ) per
 Se Style < > "Grid Table" Allora 
 
 . style = " Table Grid" 
 
 End If 
 
 . ApplyStyleHeadingRows = True 
 
 . ApplyStyleLastRow = False 
 
 . ApplyStyleFirstColumn = True 
 
 . ApplyStyleLastColumn = False 
 
 . ApplyStyleRowBands = True 
 
 . ApplyStyleColumnBands = False 
 
 End With 
 5 
 Tipo il a seguito di aggiungere i nomi dei campi per le colonne della tabella : 
 
 Selection.TypeText Text : = " Campo1 " 
 
 Unità Selection.MoveRight : = wdCell 
 
 Selection.TypeText Text : = " Campo2 " 
 
 Unità Selection.MoveRight : = wdCell 
 
 Selection.TypeText Text : = " Field3 " 
 
 Unità Selection.MoveRight : = wdCell 
 
 Selection.TypeText Testo : . = " Campo4 " 
 
 Premere " F5 " per eseguire la subroutine 
 
              
software © www.354353.com