Code: Alles auswählen.
CREATE OBJECT worddoc 'Word.APPLICATION'.
GET PROPERTY OF worddoc 'Application' = wordapp.
SET PROPERTY OF wordapp 'Visible' = 1.
GET PROPERTY OF wordapp 'Documents' = documents.
CALL METHOD OF documents 'Open'
EXPORTING
#01 = p_path.
Code: Alles auswählen.
* Variablen zum Word bearbeiten
DATA:
wordapp TYPE ole2_object,
worddoc TYPE ole2_object,
wordobj TYPE ole2_object,
word_dv TYPE ole2_object,
fields TYPE ole2_object,
documents TYPE ole2_object,
document TYPE ole2_object.
CREATE OBJECT worddoc 'Word.APPLICATION'.
GET PROPERTY OF worddoc 'Application' = wordapp.
SET PROPERTY OF wordapp 'Visible' = 1.
GET PROPERTY OF wordapp 'Documents' = documents.
CALL METHOD OF documents 'Open'
EXPORTING
#01 = p_path. "file name
GET PROPERTY OF wordapp 'ActiveDocument' = document.
"ActiveDocument.Variables("myDocVariable").Value = "Hello World"
CALL METHOD OF document 'Variables' = word_dv
EXPORTING
#1 = 'myDocVariable'.
SET PROPERTY OF word_dv 'value' = 'Hello World'.
"ActiveDocument.Fields.Update
GET PROPERTY OF document 'fields' = fields.
CALL METHOD OF fields 'Update'.