I can't open Word from Excel macro (Office XP). If I use this code, it will stop on line Set wdDoc = wordapp.Documents.Open(polozka.ShortPath)
and program freezes. If I use Set wdDoc = GetObject(polozka.ShortPath)
instead of this line, program stops here With wdDoc.Selection
with error:
"Object doesn't support this property"
Dim wordapp As Word.Application
Dim wdDoc As Word.Document
Set fso = CreateObject("Scripting.FileSystemObject")
Set files = fso.GetFolder("C:\path").Files
Set wordapp = CreateObject("Word.Application")
For Each polozka In files
Set wdDoc = wordapp.Documents.Open(polozka.ShortPath)
wordapp.Visible = True
With wdDoc.Selection
.HomeKey Unit:=6
.Find.Text = "Název (typ):"
.Find.Wrap = wdFindContinue
...
End With
...
wordapp.Quit
Set wordapp = Nothing
Next