vbscript从Outlook 2010打开本地服务器上的文件夹(vbscript to open file folder on local server from Outlook 2010)
因此,我需要在Outlook 2010中为使用自定义表单打开网络上的特定文件夹以进一步浏览图片(网络上的每个人都有权限)的人创建一个简短的子目录。 但是我有点困惑,因为这应该是一个简单的脚本来运行,但从Outlook表单的子运行,我得到一个shell错误,或wscript错误。 目前我收到错误“对象不支持此属性或方法:'objShell.Shell'
所以这是我的代码到目前为止,我尝试的每个wscript或函数似乎都给出了类似的错误:
Dim objShell
Dim ShortName
Dim AddressOnly
set objShell = CreateObject("shell.application")
If ClientCode = "1" Then
objShell.Shell.Open("Server:\path\"& ShortName &" - "& AddressOnly &"\")
ElseIf ClientCode = "2" Then
objShell.Shell.Open("Server:\path\"& ShortName &" - "& AddressOnly &"\")
ElseIf ClientCode = "3" Then
objShell.Shell.Open("Server:\path\"& ShortName &" - "& AddressOnly &"\")
End if
set objShell = nothing
So I'm in need of creating a short sub in outlook 2010 for people using custom forms to open a specific folder on the network to browse pictures further (which everyone on network has permissions). However I'm a bit confused as this should be a simple script to run, but from the sub running out of Outlook forms, I get a shell error, or wscript errors. Currently I'm getting the error of "Object does not support this property or method: 'objShell.Shell'
So here's my code so far and every wscript or function I've tried seems to give a similar error:
Dim objShell
Dim ShortName
Dim AddressOnly
set objShell = CreateObject("shell.application")
If ClientCode = "1" Then
objShell.Shell.Open("Server:\path\"& ShortName &" - "& AddressOnly &"\")
ElseIf ClientCode = "2" Then
objShell.Shell.Open("Server:\path\"& ShortName &" - "& AddressOnly &"\")
ElseIf ClientCode = "3" Then
objShell.Shell.Open("Server:\path\"& ShortName &" - "& AddressOnly &"\")
End if
set objShell = nothing
原文:https://stackoverflow.com/questions/22120250
更新时间:2020-01-30 08:21
最满意答案
所以这里是我发现现在正在使用此代码打开文件夹并通过explorer.exe显示完整内容的代码:
If ClientCode = "1" Then
folder = "Server:\path\"& ShortName &" - "& AddressOnly & "\"
ElseIf ClientCode = "2" Then
folder = "Server:\path\"& ShortName &" - "& AddressOnly & "\"
ElseIf ClientCode = "3" Then
folder = "Server:\path\"& ShortName &" - "& AddressOnly & "\"
End if
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(folder) Then
MsgBox "No Files Exist. You must create the file first before trying to find it.", vbExclamation, "No File Found."
Exit Sub
Else
'moving on
End If
set WSshell = createobject("wscript.shell")
WSshell.run "C:\WINDOWS\explorer.exe "& folder &"", 1
Set WSshell = nothing
So here is the code I've found to be working now for this option to open a folder and display the full contents through explorer.exe:
If ClientCode = "1" Then
folder = "Server:\path\"& ShortName &" - "& AddressOnly & "\"
ElseIf ClientCode = "2" Then
folder = "Server:\path\"& ShortName &" - "& AddressOnly & "\"
ElseIf ClientCode = "3" Then
folder = "Server:\path\"& ShortName &" - "& AddressOnly & "\"
End if
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(folder) Then
MsgBox "No Files Exist. You must create the file first before trying to find it.", vbExclamation, "No File Found."
Exit Sub
Else
'moving on
End If
set WSshell = createobject("wscript.shell")
WSshell.run "C:\WINDOWS\explorer.exe "& folder &"", 1
Set WSshell = nothing
相关问答
这段代码需要很长的路要走。 但这里是代码的修订版,因此您可以获得输出。 Dim fso
Dim sourceFol
Dim DestFol
Dim variable1
Dim variable2
Dim result
Set fso = CreateObject("Scripting.FileSystemObject")
If ClientCode = "1" Then
sourceFol = "\\S:\sourcepath"
D
...
您正在使用OlBodyFormat.olFormatHTML(2),但您需要OlSaveAsType.olHTML(5)。 You are using OlBodyFormat.olFormatHTML (2), but you need OlSaveAsType.olHTML (5).
你在看GAL参赛作品吗? 这些地址条目存在于GAL(基于AD)中,而不存在于Exchange邮箱的“联系人”文件夹中。 如果需要打开(非默认)PST存储的“联系人”文件夹,请调用RDOStore.GetDefaultFolder(olFolderContacts)而不是RDOSession.GetDefaultFolder(从默认存储中返回文件夹)。 可以使用RDOSession.Stores集合打开辅助PST存储。 Are you looking at the GAL entries? Thes
...
你也可以 等到同步完成 - 使用Namespace.SyncObjects集合,检索第一个SyncObject对象,调用SyncObject.Start并等待SyncObject.SyncEnd事件触发。 在扩展MAPI级别(C ++或Delphi)或Redemption (它包装扩展MAPI并可以在任何语言中使用),使用MAPI_NO_CACHE(0x200)标志(扩展MAPI中的IMsgStore :: OpenEntry)或在线模式打开消息Redemption中的RDOStore .GetM
...
若要使用Exchange服务器提供的所有功能,可以使用Microsoft的EWS(Exchange Web服务)Java API 。 To make use of all the features offered by the Exchange server, you can use the EWS (Exchange Web Services) Java API from Microsoft.
所以这里是我发现现在正在使用此代码打开文件夹并通过explorer.exe显示完整内容的代码: If ClientCode = "1" Then
folder = "Server:\path\"& ShortName &" - "& AddressOnly & "\"
ElseIf ClientCode = "2" Then
folder = "Server:\path\"& ShortName
...
您不能这样做 - 主邮箱中的所有内容都将与服务器同步。 为什么不添加PST商店? You cannot do that - everything in the primary mailbox will be synchronized with the server. Why not add a PST store?
我发现了一个向我解释这个问题的网站。 它的: http://blogs.technet.com/b/heyscriptingguy/archive/2006/08/03/how-can-i-get-access-to-a-mail-folder-that-isn-ta-subfolder-of-我展望系列inbox.aspx I found a site that explains this to me. It's: http://blogs.technet.com/b/heyscriptingg
...
因此,实验找到了解决办法 - 将WShell命令移出此VBS宏并转换为单独的VBS宏,然后从第三个宏背靠背调用它们。 这是最终的布局: 壳牌VBS: Option Explicit
SendTLShell
Sub SendTLShell()
Dim filepath
Dim oShell
Set oShell = CreateObject("Wscript.Shell")
filepath = Chr(34) & "\\myfilepath\OutlookControl.v
...