question about trying run reports with vbscript

  • Thread starter Thread starter webwork
  • Start date Start date
W

webwork

Hello,

I am trying to save broken link reports for over a hundred subwebs at
our university. Most of this is going well, but I am having trouble
closing out the previous web site. I tried several different methods
but they return an error if I don't use 'on error resume next'.

Any thoughts?


Scotty
----------------------
Private Sub save_report(Url)

If Right(Url, 1) = "/" Then Url = Mid(Url, 1, Len(Url) + 1)

'Verifies broken links in the current view

Dim objApp As FrontPage.Application
Dim objWebwdw As WebWindowEx

Set objApp = FrontPage.Application

objApp.Webs.Open (Url)

objApp.ActiveWeb.RecalcHyperlinks

objApp.ActiveWebWindow.VerifyAllLinks


titleurl = Url

fname = LCase(titleurl)
fname = Replace(fname, "http://", "")
fname = Replace(fname, "/", "_")
fname = Replace(fname, "\", "_")
fname = Replace(fname, ":", "")
fname = fname & ".htm"




objApp.ActiveWebWindow.SaveReport
reportviewModeEx:=fpWebViewExBrokenLinks, _
Title:="Broken Links for " & titleurl, _
DestinationURL:="D:\fp_reports\" & fname, _
ForceOverwrite:=True




On Error Resume Next

' all of the following cause error messages
Application.Quit

objApp.ActiveWebWindow.Close

objApp.WebWindows.Close

objApp.Webs(0).Close

objApp.ActiveWebWindow.Close

end sub
 
Try closing the currently opened active web using

FrontPage.Application.ActiveWeb.Close

which using your code would be

objApp.ActiveWeb.Close

--




| Hello,
|
| I am trying to save broken link reports for over a hundred subwebs at
| our university. Most of this is going well, but I am having trouble
| closing out the previous web site. I tried several different methods
| but they return an error if I don't use 'on error resume next'.
|
| Any thoughts?
|
|
| Scotty
| ----------------------
| Private Sub save_report(Url)
|
| If Right(Url, 1) = "/" Then Url = Mid(Url, 1, Len(Url) + 1)
|
| 'Verifies broken links in the current view
|
| Dim objApp As FrontPage.Application
| Dim objWebwdw As WebWindowEx
|
| Set objApp = FrontPage.Application
|
| objApp.Webs.Open (Url)
|
| objApp.ActiveWeb.RecalcHyperlinks
|
| objApp.ActiveWebWindow.VerifyAllLinks
|
|
| titleurl = Url
|
| fname = LCase(titleurl)
| fname = Replace(fname, "http://", "")
| fname = Replace(fname, "/", "_")
| fname = Replace(fname, "\", "_")
| fname = Replace(fname, ":", "")
| fname = fname & ".htm"
|
|
|
|
| objApp.ActiveWebWindow.SaveReport
| reportviewModeEx:=fpWebViewExBrokenLinks, _
| Title:="Broken Links for " & titleurl, _
| DestinationURL:="D:\fp_reports\" & fname, _
| ForceOverwrite:=True
|
|
|
|
| On Error Resume Next
|
| ' all of the following cause error messages
| Application.Quit
|
| objApp.ActiveWebWindow.Close
|
| objApp.WebWindows.Close
|
| objApp.Webs(0).Close
|
| objApp.ActiveWebWindow.Close
|
| end sub
|
 
Thanks for replying... I tried this and got this message:

Run-time error '2147467259 (80004005)':
Method 'Close' of object 'Web' failed

Did some looking around and found this code which did work:

CommandBars("File").Controls("Close Site").Execute

Is this an acceptable way to do this? Any thoughts?

Scotty
 
Back
Top