vba - Unable to work with word applications from excel -
i trying open word document excel stuck @ first line when using below code. have added reference still compile error user- defined type not defined.
dim oapp word.application dim osec word.section dim odoc word.document set appword = createobject("word.application") set oapp = new word.application set odoc = oapp.documents.add
you need add reference in vba context opening vba (developer tab, click: visual basic), select workbook , click menu: tools, references.
in references list find word object library , make sure checked before clicking ok
now try again, , don't forget make oapp visible! :
sub test() dim oapp word.application dim osec word.section dim odoc word.document set appword = createobject("word.application") set oapp = new word.application set odoc = oapp.documents.add oapp.visible = true end sub
Comments
Post a Comment