Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!swrinde!mips!pacbell.com!pacbell!rtech!dosbears!drp From: drp@dosbears.UUCP (David R. Preston) Newsgroups: comp.windows.ms Subject: Re: Need autosave macro for Winword Message-ID: <361@dosbears> Date: 31 May 91 04:08:20 GMT References: <1991May30.063956.9027@cunixf.cc.columbia.edu> Reply-To: drp%dosbears.uucp@ingres.com (David R. Preston) Organization: DosBears Lines: 71 In article <1991May30.063956.9027@cunixf.cc.columbia.edu> gg2@cunixf.cc.columbia.edu (Guy Gallo) writes: >> >>>I need an autosave macro for Word for Windows. >>>(I don't like just being reminded :-) >>>Anybody has written such macro? >>>I would appreciate it if s/he could >>>send me a copy (or perhaps post here). > >This was posted on the net some time back; I assume the author would not >mind my reposting: Not at all; saves me from trying to find my copy. However, the one I posted only worked certain hours of the day (probably the same hours I work :-). The following, I hope, accounts for all of the problems of converting time formats. I wrote a much more elaborate version with a bunch of options, but it runs too slow for something that is going to go off every n minutes, while you're still trying to type. Anyway, use the directions from Guy's reposting of my first attempt, but substitute the following for the macro: __________________________________________________________________ Sub MAIN If IsDirty() Then FileSave End If nextime$ = getime$(4) OnTime nextime$, "savenow" End Sub Function getime$(n) now$ = Time$() ap$ = Right$(now$, 2) hour = Val(Left$(now$, 2)) min = Val(Mid$(now$, 4, 2)) min = min + n If min > 59 Then min = min - 60 hour = hour + 1 End If If ap$ = "PM" And hour <> 12 Then hour = hour + 12 End If If hour = 24 Then hour = 0 End If If min = 0 Then min$ = "00" ElseIf min < 10 Then min$ = "0" + Right$(Str$(min), 1) Else min$ = Right$(Str$(min), 2) End If If hour = 0 Then hour$ = "00" ElseIf hour < 12 Then hour$ = "0" + Right$(Str$(hour), 1) Else hour$ = Right$(Str$(hour), 2) End If getime$ = hour$ + ":" + min$ End Function -- David R. Preston drp%dosbears.uucp@ingres.com The world hadn't ever had so many moving parts or so few labels. D. R. Preston 584 Castro St. #614 SF CA 94114 USA