Ошибка vbscript outlook

Outlook 2016 Outlook 2013 Microsoft Outlook 2010 Windows Server 2008 Enterprise More…Less

Symptoms

If you are using Microsoft Outlook in a Terminal Services environment, you cannot use Visual Basic Scripting Edition (VBScript) in custom Outlook forms. This issue can occur when you are using a Microsoft Windows Terminal Server in Install mode or User mode. This issue also occurs with Windows 2000 Terminal Server in Application mode but not in Remote Administration mode.

Cause

By default, Microsoft Office programs do not install the VBScript component in Windows Terminal Server environments.

Workaround

Use one of the following methods to work around this problem.

Method 1: Copy the Outlvbs.dll file to existing installations

To do this, follow these steps:

  1. Copy the Outlvbs.dll file from a computer that is not running Microsoft Outlook on a Terminal Server.

    Note Make sure that this computer and the Terminal Server are running the same version of Outlook when you copy the Outlvbs.dll file.

  2. Copy the Outlvbs.dll file to the appropriate Office folder of the affected Terminal Server computer for your version of Office.

    • Office 2016:

      • MSI-based installation: Program FilesMicrosoft OfficeOffice16

      • Click-to-Run installation: Program FilesMicrosoft OfficerootOffice16

    • Office 2013:

      • MSI-based installation: Program FilesMicrosoft OfficeOffice15

      • Click-to-Run installation: Program FilesMicrosoft Office 15rootOffice15

    • Office 2010: Program FilesMicrosoft OfficeOffice14

    • Office 2007: Program FilesMicrosoft OfficeOffice12

    • Office 2003: Program FilesMicrosoft OfficeOffice11

    • Office 2002: Program FilesMicrosoft OfficeOffice10

      Note If your Operating system and Office version are not the same bitness, the location will be ‘Program Files(x86)’.

    Important When you install an Outlook Update on the Terminal Server, the Outlvbs.dll file is not updated. Therefore, you must install the same update on the other computer and follow these steps to copy the Outlvbs.dll file to the Terminal Server every time an update is installed.

Method 2: Install Microsoft Office with an additional property to let the VBScript component to be installed

To do this, follow these steps:

  1. Determine the globally unique identifier (GUID) for the product that you just installed. If you installed Outlook, use that product GUID. If you installed Office Professional Plus 2010, use that product GUID. For more information about how to determine the GUID of the product that you installed, click the following article number to view the article in the Microsoft Knowledge Base:

    3120274 Description of the numbering scheme for product code GUIDs in Office 2016
    2786054 Description of the numbering scheme for product code GUIDs in Office 2013
    2186281 Description of the numbering scheme for product code GUIDs in Office 2010
    928516 Description of the numbering scheme for product code GUIDs in 2007 Office suites and programs

  2. After you have the product GUID, run the following command line:

    msiexec /i <Product Code GUID> ADDLOCAL=OutlookVBScript /qb
    Note In this command, <Product Code GUID> is a placeholder for your product GUID.

    For example, if you have Office Professional Plus 2016 installed, your product GUID would be the following:

    {90160000-0011-0409-0000-0000000FF1CE}
    In this example, the command line should appear as follows:

    msiexec /i {90160000-0011-0409-0000-0000000FF1CE} ADDLOCAL=OutlookVBScript /qb

More Information

Microsoft Office and Outlook Setup detect when you are installing Outlook on a computer configured with Terminal Services. In these situations, the support files necessary to enable VBScript in Outlook custom forms are not installed. Therefore, if you try to start the Outlook Script Editor, you receive the following error message:

Unable to load this feature. Feature ID not registered.

If you try to use a custom Outlook form that contains VBScript, you do not receive an error message, but the VBScript code in the form does not run.

Note Earlier versions of Outlook supported VBScript in a Terminal Services environment.

For more information about available resources and answers to commonly asked questions about Microsoft Outlook solutions, click the following article number to view the article in the Microsoft Knowledge Base:

287530 Frequently asked questions about custom forms and Outlook solutions

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Exchange Server 2016 Enterprise Edition Exchange Server 2016 Standard Edition Еще…Меньше

Проблема

Рассмотрим следующий сценарий.

  • Черновик сообщения создаются с помощью сценариев Visual Basic (VBScript) в папке черновика на компьютере клиента Microsoft Outlook 2016 общего почтового ящика.

  • Пользователю предоставляютсяПолный доступиОтправить от имениразрешения для общего почтового ящика и почтового ящика автоматически добавляется в свой профиль Outlook.

  • Пользователь отправляет черновик сообщения от имени почтового ящика в Outlook 2016 клиента на том же или другом компьютере.

В этом случае пользователь получает отчет о недоставке (NDR) сообщение, подобное приведенному ниже:

Из: shared_mailbox_name
Отправлено: Дата и время
К: Test@contoso.com
Тема: Не удается доставить: тест

Сообщение не было получено одним или несколькими получателями.
Тема: тест
Отправлено: Дата и время
Не получили следующие получатели:
Display_name на
Получатель был удален или нет адреса электронной почты.

Причина

Эта проблема возникает из-за обнаружения в Outlook оставляет сообщение неразрешенных получателей, когда свойство EntryID или Тип адреса сообщения не указан правильно.

Решение

Exchange Server 2016

Для решения этой проблемы установите Накопительное обновление 10 2016 Exchange Server или более поздней версии накопительного обновления 2016 Exchange Server.

Ссылки

Дополнительные сведения о терминологии , которую корпорация Майкрософт использует для описания обновлений программного обеспечения.

Нужна дополнительная помощь?

Нужны дополнительные параметры?

Изучите преимущества подписки, просмотрите учебные курсы, узнайте, как защитить свое устройство и т. д.

В сообществах можно задавать вопросы и отвечать на них, отправлять отзывы и консультироваться с экспертами разных профилей.

Our computers were upgraded to Office 2007.  The following script fails to work on 2007, but works in 2003.

Look for the comment FAILS HERE

CreateObject(«Outlook.Application») returns an error that the ActiveX object cannot be created:

' ------------------------------------------- LOADMAILBOX ---------------------------------------------
	public SevereError
	Dim NS					  ' As NameSpace
	Dim objOutlook				' As Application
								' Dim objInbox As Outlook.MAPIFolder
	Dim objFolder				' As Outlook.MAPIFolder
	Dim Item          ' As Object
	Dim objItems				' As Object, MailItem but could be something else
	'Dim ItemCount				' Number of mailbox items from objFolder.Items.Count, from LoadMailBox
	Dim Icount				  ' Folder loop counter
	Dim strFolderName

	Set NS = Nothing
	set objOutlook = Nothing
	'Set objInbox = Nothing
	'Set objFolder = Nothing
	'Set objItems = Nothing
	dim env
	env=1
	
	strFolderName = "Public Folders/All Public Folders/USN/NAVAIR/ORLO/Functional Mailboxes/ORLO_498 MUSTER"
	
	set objOutlook = Nothing
	On Error GoTo 0
	Set objOutlook = CreateObject("Outlook.Application")
	
	'Try starting outlook again if it wasn't running SCRIPT FAILS HERE!!!!!
	If objOutlook Is Nothing Then 
		Set objOutlook = CreateObject("Outlook.Application")
	End If
'THIS SECOND TRY IS SIMPLE DESPERATION.....
	Set NS = objOutlook.GetNamespace("MAPI")
	Set objFolder = GetFolder(strFolderName)
	AddInfo "Using Mailbox: " & strFolderName ,1
	On Error Resume Next

	MessageCount = CInt(objFolder.Items.Count)
	AddInfo ("LoadMailBox Messagecount=" & MessageCount), 1

	AddInfo "Loading Muster Mailbox content",1
	Set Item = objFolder.Items
	On Error Goto 0

	For Icount = 1 To MessageCount
		' MessageCount comes from the count property of the folder in Outlook
		addinfo "LoadMailBox, Icount = " & Icount & " MessageCount=" & MessageCount, 1
		addinfo "SentOn =   " & Item(Icount).SentOn, 1
		addinfo "SenderName = " & Item(Icount).SenderName, 1
		addinfo "Subject =  " & Item(Icount).Subject, 1
		addinfo "Body =    " & Item(Icount).Body, 1
	Next 'Icount

	' **************************** END READ MAILBOX LOOP *********************************
	' ******************* LOADING OF MESSAGES INTO MEMORY IS COMPLETE *****************
	'          This means all the messages, regardless of date




	AddInfo MessageCount & " Muster Messages found in LoadMailBox, Reading Inbox complete.", 1


'-------------------------------  GETFOLDER ---------------------------------------------
Public Function GetFolder(strFolderPath)

	' folder path needs to be something like:
	' "Public FoldersAll Public FoldersCompanySales"

	Dim objApp			' As Outlook.Application
	Dim objNS      ' As Outlook.NameSpace
	Dim colFolders			' As Outlook.Folders
	Dim objFolder			' As Outlook.MAPIFolder
	Dim arrFolders			' As String array
	Dim I				' As Long

	On Error Goto 0
	'On Error Resume Next

	if dbg then AddInfo "GetFolder path = " & strFolderPath, 1

	strFolderPath = Replace(strFolderPath, "/", "")
	if dbg then AddInfo "Adjusted folder path = " & strFolderPath,1
	arrFolders = Split(strFolderPath, "")
	Set objApp = CreateObject("Outlook.Application")

	' If Outlook is not installed, the folder will be nothing
 	If Err.number <> 0 Then
		AddInfo "Function GetFolder, CreateObject Outlook.Application",1
		ShowError
		Err.Clear
		On Error Goto 0
		Severe_Error = True
		'GetFolder = Nothing
		'objApp = Nothing
		Exit Function
 	End If

	Set objNS = objApp.GetNamespace("MAPI")
	Set objFolder = objNS.Folders.Item(arrFolders(0))

	On Error Resume Next

	If Not objFolder Is Nothing Then
		For I = 1 To UBound(arrFolders)
			Set colFolders = objFolder.Folders
			Set objFolder = Nothing
			Set objFolder = colFolders.Item(arrFolders(I))

			If Err.Number <> 0 then
				Msgbox "It appears that you do not have access permissions to the Muster Mailbox, call the Mailbox Owner"
				Err.Clear
				Severe_Error = True
				Exit Function
			End If

			if dbg then AddInfo "Folder = " &objFolder, 1

			If objFolder Is Nothing Then
				Exit For
			End If
		Next 'I

	Else

		GetFolder = Nothing
	End If


	Set GetFolder = objFolder
	'If Dbg Then  MsgBox("Getfolder is returning " & GetFolder)

	On Error Resume Next
	Set colFolders = Nothing
	Set objNS = Nothing
	Set objApp = Nothing
	On Error Goto 0
End Function



' ------------------------------------- ADDINFO ---------------------------------------
Sub AddInfo(Text, NewLine)
	Dim L 

	If Env=1 Then
		If NewLine then
			Wscript.StdOut.WriteLine Text
		Else
			Wscript.StdOut.Write Text
		End If

		'WScript.Echo Text
	Else
		L = Len(Text2) + Len(Text)
		if L >32767 then Text2 = Right(Text2, 32760 - Len(Text))

		if newline then 
			Text2 = Text2 & vbcrlf & text 
			TextArea2.value = Text2
		else
			TextArea2.value = Text2 & Text
		end if
	End If

	End Sub

 Thanks for your help!!

Mark


Navy Firefighting Engineer

  • Remove From My Forums
  • Question

  • Hello,

    I would like to incorporate a VBScript into group policy to create an Outlook rule for our users.  The following article mentions how to get started: 
    http://msdn.microsoft.com/en-us/library/bb206765(v=office.12).aspx

    In testing the code in this article by running the VBScript from command line I receive the following message:

    c:UsersgtateDesktopCreateOutlookRSSRule.vbs(4, 18) Microsoft VBScript compilation error: Expected end of statement

    Any ideas on what I’m doing wrong? 

    Here’s the content of my script:

    CreateRule()
    
    Sub CreateRule()
        Dim colRules As Outlook.Rules
        Dim oRule As Outlook.Rule
        Dim colRuleActions As Outlook.RuleActions
        Dim oMoveRuleAction As Outlook.MoveOrCopyRuleAction
        Dim oFromCondition As Outlook.ToOrFromRuleCondition
        Dim oExceptSubject As Outlook.TextRuleCondition
        Dim oInbox As Outlook.Folder
        Dim oMoveTarget As Outlook.Folder
    
        'Specify target folder for rule move action
        Set oInbox = Application.Session.GetDefaultFolder(olFolderInbox)
        'Assume that target folder already exists
        Set oMoveTarget = oInbox.Folders("Dan")
        
        'Get Rules from Session.DefaultStore object
        Set colRules = Application.Session.DefaultStore.GetRules()
        
        'Create the rule by adding a Receive Rule to Rules collection
        Set oRule = colRules.Create("Dan's rule", olRuleReceive)
    
        'Specify the condition in a ToOrFromRuleCondition object
        'Condition is if the message is from "Dan Wilson"
        Set oFromCondition = oRule.Conditions.From
        With oFromCondition
            .Enabled = True
            .Recipients.Add ("Dan Wilson")
            .Recipients.ResolveAll
        End With
    
        'Specify the action in a MoveOrCopyRuleAction object
        'Action is to move the message to the target folder
        Set oMoveRuleAction = oRule.Actions.MoveToFolder
        With oMoveRuleAction
            .Enabled = True
            .Folder = oMoveTarget
        End With
    
        'Specify the exception condition for the subject in a TextRuleCondition object
        'Exception condition is if the subject contains "fun" or "chat"
        Set oExceptSubject = _
            oRule.Exceptions.Subject
        With oExceptSubject
            .Enabled = True
            .Text = Array("fun", "chat")
        End With
    
        'Update the server and display progress dialog
        colRules.Save
    End Sub
    

Answers

  • Hello Greg,

    VBScript syntax is a bit different than VBA. It looks like the error is related to the first Dim statement in the code. Most probably it doesn’t allow to declare
    the type.

    Anyway, due to the fact that the issue is not related to Outlook I’d recommend asking VB script related questions in the

    Scripting forums instead. There you will get the most qualified feedback.

    • Marked as answer by

      Monday, March 17, 2014 12:31 PM

I’m designing a Outlook Contact form. None of the sample code I’ve tried to put in the View Code button’s Script Editor does anything. The most basic example is:

Sub Item_Open()
 msgbox "Hello World"
End Sub

When I click the Run This Form button, no message box or error message appears. It seems to totally ignore the VBScript. The same thing happens with every bit of sample code I’ve tried.

This is my first time doing any development for Office or in VBA or VBScript, so I assume I’m missing something basic, but I’ve watched and read a few tutorials, doing exactly what was shown and nothing works. I can design and publish a Contact form with custom fields and and basic combo boxes.

In the Trust Center I have Macro Settings set to «Notifications for all macros» and the Email Security options «Allow script in shared folders» and «Allow script in Public Folders» are both checked.

I’m designing a Contact form using Office 365 32-bit Version 1708 (Build 8431.2079 Click-to-Run) Monthly Channel on Windows 10 x64 Version 1703 Build 15063.608.

Any help would be greatly appreciated!!

Thank you!

Понравилась статья? Поделить с друзьями:

Не пропустите эти материалы по теме:

  • Яндекс еда ошибка привязки карты
  • Ошибка vbs прикол
  • Ошибка vbs 0x80041002
  • Ошибка vba run time error 9
  • Ошибка usb virtualbox

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии