I have a piece of code in excel that modifies an embedded word document (displayed as icon) and saves it to a path. I have to convert it to late binding because of compatibility issues. How do i do it? What do I have to change? here is part of my code, as an example
Function Sport()
Dim wd As Word.Application
Dim doc As Word.Document
Dim ole As OLEObject
Dim EmbededFile As String
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("Sheet with the embedded file")
' Change to suit your needs, or build with code
EmbededFile = ThisWorkbook.path & "\Stuff.doc"
Set ole = ws.OLEObjects("Object")
ole.Activate
'ole.Verb Verb:=xlOpen
Set wd = ole.Object.Application
With wd.ActiveDocument
.SaveAs EmbededFile, Word.wdFormatDocumentDefault
.Close
End With
Set doc = wd.Documents.Open(EmbededFile)
'' do stuff
wd.Activate
doc.Close
wd.Quit
Sport = 3
End Function
thanks in advance for the help