Re: Sudden macro error

From: Word Heretic (myfullname_at_tpg.com.au)
Date: 01/05/05


Date: Thu, 06 Jan 2005 10:40:44 +1100

G'day no.mail@reply.here (Mark),

When it fails, note the filepath of the object and look it up. I bet
you it is one of the missing ones. Word 2k doesnt validate these
entries, Word 2003 might. If the failing object doesn't exist on the
disk as indicated, then your on error can immediately flag that entry
as bad and remove it on the spot. I would also throw a debug statement
in to see whether any of teh netries are thus processed by your
existing logic in Word 2003.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice

Mark reckoned:

>But this works in Word 2000, the entry in the recentfile list is removed
>because the filename no longer exists. All that first section is doing is
>parsing RecentFiles for filenames/paths, it isn't checking their existence
>until the section after where it fails.
>Perhaps you can suggest why it is failing there where indicated?
>Mark
>
>Word Heretic (myfullname@tpg.com.au) wrote:
>
>> G'day no.mail@reply.here (Mark),
>>
>> LOL - it is exactly what you are testing for. If the file no longer
>> exists its path is invalid lol
>>
>> Steve Hudson - Word Heretic
>>
>> steve from wordheretic.com (Email replies require payment)
>> Without prejudice
>>
>>
>> Mark reckoned:
>>
>> >I've noticed the failure of several macros recently, they worked
>> perfectly >for years under Word 2000 and have stopped with Word 2002. No
>> idea why.
>> >
>> >This is typical. It stops at rf.Path with Runtime error 5152: Method
>> 'path' >of object 'RecentFile' failed. When in debug mode, 'Fullname'
>> contains the >full file name/path of the first RecentFile so I don't see
>> how rf.Path and >rf.Name have failed!
>> >---
>> >Sub CleanRecentFileList()
>> >' Cleans history on file menu
>> >' if file cannot be seen, it is removed from the list.
>> >
>> > Dim rf As RecentFile, FullName As String
>> > Const CLEARABSENTNETDOCS As Boolean = False
>> > ' Change to True to delete docs on absent network drives
>> > Const CLEARABSENTREMOVABLES As Boolean = True
>> > ' Change to False to retain docs on absent removable drives
>> > For Each rf In RecentFiles
>> > FullName = rf.Path & Application.PathSeparator & rf.Name ' Fails here!
>> >
>> > If FullName = Application.PathSeparator And CLEARABSENTNETDOCS Then
>> > ' Probably absent network drive
>> > rf.Delete
>> > Else
>> > On Error Resume Next
>> > ' VBA raises error if file is on absent removable disk
>> > If Dir(FullName) = "" Then
>> > If (Err.Number <> 0 And CLEARABSENTREMOVABLES) Or (Err.Number =
>> > > 0) >Then
>> > rf.Delete
>> > End If
>> > Err.Clear
>> > End If
>> > On Error GoTo 0 ' Reinstate normal VBA error handling
>> > End If
>> > Next
>> >End Sub
>> >---
>> >
>> >Any ideas? Is it a missing reference?
>> >
>> >
>> >Mark
>
>



Relevant Pages

  • Re: Cover pages
    ... Sorry to jump in but is there any way to fax just a cover page? ... FaxServer.send fails if you do not specify a filename with the ...
    (microsoft.public.win2000.fax)
  • Re: a script to create files
    ... of automating it by writing a shell script which does it for me. ... Useless use of continue ... Fails to uppercase the filename in the guard condition, ... Fails to put quotation marks around the filename. ...
    (comp.unix.shell)
  • Re: printing error mesgs.
    ... > I'm trying to print out error mesgs. ... in my program if some call fails. ... > I want to print the filename and the line no. in which it occurred. ... float *x = NULL; ...
    (comp.lang.c)
  • Re: piping find to zip -- with spaces in path
    ... But that fails when the filename contains a quote character. ... Perhaps a script to just remove all of the non-ascii characters in the filename of all files in the current directory? ... The underscore is often included in the set of 'ascii characters'. ...
    (Debian-User)
  • RE: How to display pdf file in full screen
    ... Steve, your information ... best solution that I found was installing the PowerPoint Add-in from Shyam ... > an Adobe object and set its behaviour through "Action Setting/Mouse ... I have tried to record a macro to do all of this, but it fails to ...
    (microsoft.public.powerpoint)