I have created the below code for exporting an embedded Word document in a Excel Sheet to the workbook's path:
Private Sub Export()
Dim sh As Shape
Dim objWord As Object 'Word.Document
Dim objOLE As OLEObject
Set sh = Sheet5.Shapes("Object 1")
sh.OLEFormat.Activate
Set objOLE = sh.OLEFormat.Object
Set objWord = objOLE.Object
objWord.Application.Visible = False
objWord.SaveAs2 Filename:=ActiveWorkbook.Path & "\MyTemplate.docx", FileFormat:= _
wdFormatDocumentDefault
objWord.Application.Quit
End Sub
It is working perfectly on Excel 2013, but when I tried running it in my office on Excel 2007, it gave me a Run-time error '438' "Object doesn't support this property or method" at the line objWord.SaveAs2 Filename:=ActiveWorkbook.Path & "\MyTemplate.docx", FileFormat:= wdFormatDocumentDefault
Have tried playing around with defining objWord but with no luck. Any suggestions?