K
Kevin
I have some VBScript that passes a URL to Word via OLE Automation. The
URL (http://TestDomain/WordTest/test.asp) points to a site using Basic
Authentication as the authentication method. Word generates the
following error on the Open method of the Documents object,
The document name or path is not valid. Try one or more of the
following:
* Check the path to make sure it was typed correctly.
* On the File menu, click Open. Search for the file using this dialog
box. (http://TestDomain/../test.asp)
However, if I open the same URL through Word's File Open dialog, Word
will generate a dialog requesting user credentials and successfully
load the page. There's no problem if the authentication method is
anonymous access. Also, Word will successfully load the page without a
dialog if the user's credentials are also sent along with the URL in
the following format:
(http://username:password@@TestDomain/WordTest/test.asp).
Unfortunately, passing the username and password in the URL is not an
acceptable solution.
Any ideas on why Word won't throw a dialog through automation on sites
using Basic Authentication? I'm using Word XP on Win 2K SP3.
VBScript code:
Dim oWord
Dim i
On Error Resume Next
Set oWord = CreateObject("Word.Application")
If Err.Number = 0 Then
With oWord
.Visible = True
.Documents.Open "http://TestDomain/WordTest/test.asp"
If Err.Number <> 0 Then
MsgBox "Err.Number = " & Err.number & vbCrLf & _
"Err.Source = " & Err.Source & vbcrlf & _
"Err.Description = " & Err.Description
Else
For i = .ActiveDocument.Hyperlinks.Count to 1 Step -1
.ActiveDocument.Hyperlinks(i).Delete
Next
.ActiveWindow.View.TableGridlines = False
Msgbox "Test", vbInformation, "Test"
End If
End With
End If
Set oWord = Nothing
ASP page code:
<%
response.write "<html><head><title>Testing
Word</title></head><body><H1>Hello World</H1></body></html>"
%>
URL (http://TestDomain/WordTest/test.asp) points to a site using Basic
Authentication as the authentication method. Word generates the
following error on the Open method of the Documents object,
The document name or path is not valid. Try one or more of the
following:
* Check the path to make sure it was typed correctly.
* On the File menu, click Open. Search for the file using this dialog
box. (http://TestDomain/../test.asp)
However, if I open the same URL through Word's File Open dialog, Word
will generate a dialog requesting user credentials and successfully
load the page. There's no problem if the authentication method is
anonymous access. Also, Word will successfully load the page without a
dialog if the user's credentials are also sent along with the URL in
the following format:
(http://username:password@@TestDomain/WordTest/test.asp).
Unfortunately, passing the username and password in the URL is not an
acceptable solution.
Any ideas on why Word won't throw a dialog through automation on sites
using Basic Authentication? I'm using Word XP on Win 2K SP3.
VBScript code:
Dim oWord
Dim i
On Error Resume Next
Set oWord = CreateObject("Word.Application")
If Err.Number = 0 Then
With oWord
.Visible = True
.Documents.Open "http://TestDomain/WordTest/test.asp"
If Err.Number <> 0 Then
MsgBox "Err.Number = " & Err.number & vbCrLf & _
"Err.Source = " & Err.Source & vbcrlf & _
"Err.Description = " & Err.Description
Else
For i = .ActiveDocument.Hyperlinks.Count to 1 Step -1
.ActiveDocument.Hyperlinks(i).Delete
Next
.ActiveWindow.View.TableGridlines = False
Msgbox "Test", vbInformation, "Test"
End If
End With
End If
Set oWord = Nothing
ASP page code:
<%
response.write "<html><head><title>Testing
Word</title></head><body><H1>Hello World</H1></body></html>"
%>