![]() |
#1
|
|||
|
|||
![]()
Hi,
I am working in a word template 2007 in which i have to open other word file using vba and copy the data from that to template. I am facing the problem error message, because of word file has got lot of pages to open and by the time it opens copy command is executed and throughing the error message. I did worked in excel to keep application.wait() Can any of you help me how to keep code execution wait till word file is open? here is my sample code i used: Documents.Open FileName:=txt_FileName.text Windows(txt_FileName.text).Activate UsereCoverRemove Selection.WholeStory Selection.Copy Windows(sActiveDoc).Activate Thank you.. SDondeti |
#2
|
||||
|
||||
![]()
Hi SDondeti,
Try something along the lines of: Code:
Dim Doc As Document Set Doc = Documents.Open(FileName:=txt_FileName.Text) With Doc .Range.Copy sActiveDoc.Paste End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|