Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

How to intercept Save()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frank Perry - 28 Apr 2006 15:16 GMT
Howdy,

I need to call UndoClear periodically during a process.  The problem is that
the process runs for hours and Word grows to 300+ Megs and crashes before the
process finishes.  Alas, I don't control what goes on in the process so I
have to find a way to clear the undo stack periodically.

I found that the Save() function is called by the background save.  I can
intercept the save and make it clear the stack.  How do I get my Save to
save?  I tried:

Public Sub Save()
   ActiveDocument.UndoClear
   Application.ActiveDocument.Save
End Sub

But the save just calls itself.  How do I get to the original Save?

Thanks for any help.
Signature

Frank Perry
LavaLeaf Software

Jean-Guy Marcil - 28 Apr 2006 15:50 GMT
Frank Perry was telling us:
Frank Perry nous racontait que :

> Howdy,
>
> I need to call UndoClear periodically during a process.  The problem
> is that the process runs for hours and Word grows to 300+ Megs and
> crashes before the process finishes.  Alas, I don't control what goes

Why not?

> on in the process so I have to find a way to clear the undo stack
> periodically.
[quoted text clipped - 11 lines]
>
> Thanks for any help.

Have you tried calling the sub FileSave()? This is the save that is called
when a user clicks on Save or does CTRL-S. I do not know if this is called
by your process.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Frank Perry - 28 Apr 2006 16:23 GMT
Howdy,

I can't change the process because it is in a COTS package and we don't have
source code.

I have tried to intercept the Save function but when it runs, I get an error
Compiler Error:
Member already exists in an object module from which this object module
derives.

There is an earlier post to this group for a similar problem.  I tried
various versions of their suggestions and I still get the error.   I even
removed the Save from inside my call and still got the same error.
Signature

Frank Perry
LavaLeaf Software

> Frank Perry was telling us:
> Frank Perry nous racontait que :
[quoted text clipped - 26 lines]
> when a user clicks on Save or does CTRL-S. I do not know if this is called
> by your process.
Jean-Guy Marcil - 28 Apr 2006 17:28 GMT
Frank Perry was telling us:
Frank Perry nous racontait que :

> Howdy,
>
[quoted text clipped - 5 lines]
> Member already exists in an object module from which this object
> module derives.

Sounds like your COTS package (COTS?) already intercepts the FileSave
procedure...

Maybe you can try the BeforeSave event:
   http://word.mvps.org/faqs/macrosvba/AppClassEvents.htm

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 


Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.