如题,我是想用office在线编辑器打开文档时,能制定需要编辑的文档所在的文件夹
<script language="VBScript">
Dim bDocOpen Sub oframe_OnDocumentOpened(str, obj)
Dim s, s2
On Error Resume Next
bDocOpen = True if len(str) = 0 then
str = "New Document"
else
Dim x
x = InStr(str, "\")
if x then
do
str = mid(str, x+1)
x = Instr(str, "\")
loop while x > 0
else
x = Instr(str, "/")
if x Then
do
str = mid(str, x+1)
x = Instr(str, "/")
loop while x > 0
end if
end if
end if s = obj.Application.Name
if len(s) = 0 then s = "Unknown Server" document.all.tstat.InnerHTML = "File: " & str & "<br>Server: " & s
End Sub Sub oframe_OnDocumentClosed()
bDocOpen = False
document.all.tstat.InnerHTML = "Try another file."
End Sub Sub NewDoc()
On Error Resume Next
oframe.showdialog 0 'dsoDialogNew
if err.number then
MsgBox "Unable to Create New Object: " & err.description
end if
End Sub Sub OpenDoc()
On Error Resume Next
document.all.oframe.showdialog 1 'dsoDialogOpen
if err.number then
MsgBox "Unable to Open Document: " & err.description
end if
End Sub
Sub OpenWebDoc()
Dim sUrl
On Error Resume Next
sUrl = InputBox("Type the URL to a file on a Web Folder...", ,"http://[server]/[folder]/test.doc")
If Len(sUrl) Then
oframe.open sUrl, true
if err.number then
MsgBox "Unable to Open URL: " & err.description
end if
End If
End Sub Sub SaveCopyDoc()
On Error Resume Next
If Not bDocOpen Then
MsgBox "You do not have a document open."
Else
oframe.showdialog 3 'dsoDialogSaveCopy
End If
End Sub Sub ChgLayout()
On Error Resume Next
If Not bDocOpen Then
MsgBox "You do not have a document open."
Else
oframe.showdialog 5 'dsoDialogPageSetup
End If
End Sub Sub PrintDoc()
On Error Resume Next
If Not bDocOpen Then
MsgBox "You do not have a document open."
Else
oframe.printout True
End If
End Sub Sub CloseDoc()
On Error Resume Next
If Not bDocOpen Then
MsgBox "You do not have a document open."
Else
oframe.close
End If
End Sub Sub ToggleTitlebar()
Dim x
On Error Resume Next
x = oframe.Titlebar
oframe.Titlebar = Not x
End Sub Sub ToggleMenubar()
Dim x
On Error Resume Next
x = oframe.Menubar
oframe.Menubar = Not x
oframe.Activate
End Sub
</script>
红色部分代码怎能改?源代码可以浏览选择所有目录下的文件,我想在点击了打开文档按钮后,只显示指定目录下的文件。
<script language="VBScript">
Dim bDocOpen Sub oframe_OnDocumentOpened(str, obj)
Dim s, s2
On Error Resume Next
bDocOpen = True if len(str) = 0 then
str = "New Document"
else
Dim x
x = InStr(str, "\")
if x then
do
str = mid(str, x+1)
x = Instr(str, "\")
loop while x > 0
else
x = Instr(str, "/")
if x Then
do
str = mid(str, x+1)
x = Instr(str, "/")
loop while x > 0
end if
end if
end if s = obj.Application.Name
if len(s) = 0 then s = "Unknown Server" document.all.tstat.InnerHTML = "File: " & str & "<br>Server: " & s
End Sub Sub oframe_OnDocumentClosed()
bDocOpen = False
document.all.tstat.InnerHTML = "Try another file."
End Sub Sub NewDoc()
On Error Resume Next
oframe.showdialog 0 'dsoDialogNew
if err.number then
MsgBox "Unable to Create New Object: " & err.description
end if
End Sub Sub OpenDoc()
On Error Resume Next
document.all.oframe.showdialog 1 'dsoDialogOpen
if err.number then
MsgBox "Unable to Open Document: " & err.description
end if
End Sub
Sub OpenWebDoc()
Dim sUrl
On Error Resume Next
sUrl = InputBox("Type the URL to a file on a Web Folder...", ,"http://[server]/[folder]/test.doc")
If Len(sUrl) Then
oframe.open sUrl, true
if err.number then
MsgBox "Unable to Open URL: " & err.description
end if
End If
End Sub Sub SaveCopyDoc()
On Error Resume Next
If Not bDocOpen Then
MsgBox "You do not have a document open."
Else
oframe.showdialog 3 'dsoDialogSaveCopy
End If
End Sub Sub ChgLayout()
On Error Resume Next
If Not bDocOpen Then
MsgBox "You do not have a document open."
Else
oframe.showdialog 5 'dsoDialogPageSetup
End If
End Sub Sub PrintDoc()
On Error Resume Next
If Not bDocOpen Then
MsgBox "You do not have a document open."
Else
oframe.printout True
End If
End Sub Sub CloseDoc()
On Error Resume Next
If Not bDocOpen Then
MsgBox "You do not have a document open."
Else
oframe.close
End If
End Sub Sub ToggleTitlebar()
Dim x
On Error Resume Next
x = oframe.Titlebar
oframe.Titlebar = Not x
End Sub Sub ToggleMenubar()
Dim x
On Error Resume Next
x = oframe.Menubar
oframe.Menubar = Not x
oframe.Activate
End Sub
</script>
红色部分代码怎能改?源代码可以浏览选择所有目录下的文件,我想在点击了打开文档按钮后,只显示指定目录下的文件。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货