html - Copying text from word using vba to an excel cell -
i have issue regarding vba. i`m trying copy text content word documents excel sheet specific cell. now, have no trouble copying content single string, keep formatting. have tried using following:
activesheet.pastespecial format:="microsoft word 8.0 document object"
but sadly copies image of document (albeit in right cell).
is there way using vba? there hundreds of documents, therefore doing hand not feasible.
alternatively, if not possible, happy, if documents pasted html indications line breaks , spacing.
thank help!
edit 28/7, 13:18:
'create instance of filesystemobject set objfso = createobject("scripting.filesystemobject") 'get folder object set objfolder = objfso.getfolder("c:\afloder") = 10 'loop through each file in directory , prints names each objfile in objfolder.files 'print file name temp = cstr(objfile.name) splittedtemp = split(temp, ".") cells(i + 1, 1) = splittedtemp(0) 'paste in content doc = cstr("c:\afolder\" & objfile.name) set worddoc = word.documents.open(doc) word.activedocument.content.copy 'call paste procedure worksheets("communication template").cells(i + 1, 9).select doevents activesheet.pastespecial format:="microsoft word 8.0 document object", displayasicon:=false worddoc.close savechanges:=false set worddoc = nothing = + 1 next objfile set wordapp = nothing
Comments
Post a Comment