I agree it does seem you are stumbling around a bit. First of all, please clarify if you are executing this from Excel. If so, then for sure you need to do as macropod suggests (ensuring you DO have a reference to Word!). If you are executing from Excel then:

Dim doc As Document

will be meaningless to VBA. Document is not an Excel term.