Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-26-2011, 09:23 AM
SDondeti SDondeti is offline Applicatin.wait Windows XP Applicatin.wait Office 2007
Novice
Applicatin.wait
 
Join Date: Apr 2011
Posts: 7
SDondeti is on a distinguished road
Default Applicatin.wait

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
Reply With Quote
  #2  
Old 05-27-2011, 02:12 AM
macropod's Avatar
macropod macropod is offline Applicatin.wait Windows 7 32bit Applicatin.wait Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply



Other Forums: Access Forums

All times are GMT -7. The time now is 09:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft