Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

appWord.visible causing problems....

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi - I'm writing a excel macro that opens a word document and searches for a certain special style of text (called "Fastpath"), throws that block of text into a cell (which is never longer than 5 characters), then scrolls up in the document until it reaches a Heading 1 or Heading 2, at which point it selects all of THAT text and copies it into another cell. It then jumps down to where it originally found the "Fastpath" and continues searching.

Not a simple task but it works fairly well except for one thing: it doesn't work unless I set the Word application's visible property to true. That is, if I sit there and watch it zip through the document and do it's thing, it works perfectly. However, if I want it to run in the background, it freezes at certain points. The ONLY change I have ever made between these instances is to either have a line which says "appWord.visible = true", or to comment it out.

Does anybody know why this property would have any effect besides a graphical one?

Thanks,
Jester
 
Here's a little block of code I took from one of my Excel/Word macros....funny, the macro you described is real real similiar to the one I have.

If appWord Is Nothing Then
Set appWord = New Word.Application
End If
appWord.Visible = False
Application.ScreenUpdating = False
Set fileWord = appWord.Documents.Open(fn) 'fn is a filename
Application.ActivateMicrosoftApp xlMicrosoftWord
 
Are you using the selection object? This sometimes requires the app to be visible. Use range objects instead and visibility won't matter.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top