Results 1 to 8 of 8

Thread: SaveAll VBA

  1. #1
    jtcougar
    Guest

    SaveAll VBA

    Using Microsoft article Q256080, I created a SaveAll macro for FrontPage using VBA. It looks like this:

    Sub SaveAll()
    Dim page As PageWindow
    For Each page In Application.ActiveWebWindow.PageWindows
    page.Save
    Next
    End Sub

    However debug always has a problem with the page.Save line.

    I'm not a VBA expert and have no idea what's wrong. Any help is appreciated.

    Jim

  2. #2
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SaveAll VBA

    Just tried it:
    If the web is on a local drive - no problem
    If the web is on a network drive, it bombs on the page.Save line.
    Is this what you are doing?

  3. #3
    jtcougar
    Guest

    Re: SaveAll VBA

    Leif,

    It's on my c: drive.

    Jim

  4. #4
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SaveAll VBA

    Rats!
    I just found that if it is on a network drive, rather that using 'ServerCWeb..' a mapped drive works!
    **
    Did you copy'n'paste that code into your first post?
    I copied what you wrote (via notepad) straight into a module and it worked first time.
    Select the word 'page' in the macro, then use Debug/Add Watch and check what value it gives to 'page' in the 'Watches' window - does it look correct?
    What error message are you getting?

  5. #5
    jtcougar
    Guest

    Re: SaveAll VBA

    page gives - <out of context> PageWindow
    page.Save gives - <Expression not defined in context> Empty

    Is this what you're asking about?

    Jim

  6. #6
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SaveAll VBA

    This is what I see when I step through using F8:
    Attached Images Attached Images
    • File Type: png x.png (9.2 KB, 0 views)

  7. #7
    jtcougar
    Guest

    Re: SaveAll VBA

    Leif,

    I can't explain it but I got it to work. On the first attempts, I was editing the web directly from by c:inetpub directory and creating the macro. So I decided to open the web as http:[localcomputername][webname]. Then I recreated the macro and assigned it to the File menu. Finally, it worked.

    Thanks for your help.

    Jim

  8. #8
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SaveAll VBA

    Glad to see you got it working. There is obviously something critical in the path - beyond my minimal expertise but worth noting for the future.

Posting Permissions

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