











| |
Infoga text i dokument
|
|
Du kan adressera olika "objekt" i Word och infoga text vid
ett sådant objekt utan att för den skull först göra besväret att (som
i gamla versioner) markera, välja och sedan infoga.
ActiveDocument.Words(1).Text = "OrdNr1"
ActiveDocument.Paragraphs(1).Range.Text = "Första styckets text."
ActiveDocument.Bookmarks("EttBokmärkesNamnHär").Range.Text =
"valfri text"
ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Text = "Text i sidhuvudet"
ActiveDocument.Tables(1).Columns(3).Cells(1).Range.Text = "valfri
text"
Försök att undvika att använda Selection-objektet om möjligt
(selection=vid markören/insättningspunktens position) .
Det går snabbare att köra kod om du som ovan anger vad/vilket objekt
du vill påverka
Selection.InsertAfter "valfri text"
Selection.InsertAfter Text:="valfri text"
Selection.TypeText "valfri text"
Selection.TypeText Text:="valfri text"
|
|