Consulting

Results 1 to 2 of 2

Thread: Script to remove custom views

  1. #1
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location

    Script to remove custom views

    Hi,
    Using Excel 2003
    and shared files (I know, I know).
    One of the problems of an ever increasing file size, is that Excel stores custom views for each user.
    Does anyone know a way I can script so that when the Excel worksheet is closed down, it will remove the custom views that it has stored?

    Thanks in advance.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    No idea if this works, I wouldn't touch shared files with a barge pole

    [vba]

    Sub RemoveCustomViews()
    Dim cv As CustomView

    For Each cv In ActiveWorkbook.CustomViews

    cv.Delete
    Next cv
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •