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

enter image description here

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

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -