Article ID: 174469 - Last Review: January 20, 2007 - Revision: 2.2 OL97: Problems Automating Microsoft Word from VBScriptThis article was previously published under Q174469 On This PageSYMPTOMS
When automating Microsoft Word from a custom Microsoft Outlook 97 form
using Visual Basic Scripting Edition (VBScript), you receive any of the
three following errors:
Using the Word.Basic object with Microsoft Word 95:
Operation failed.
Object doesn't support this property or method.
Type Mismatch.
CAUSE
These problems are specific to what versions of VBScript and Microsoft Word
you are using.
WORKAROUND
If you are using the Word.Basic object with Microsoft Word 95, either:
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either
expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes
that you are familiar with the programming language being demonstrated and the
tools used to create and debug procedures. Microsoft support professionals can
help explain the functionality of a particular procedure, but they will not
modify these examples to provide added functionality or construct procedures to
meet your specific needs. If you have limited programming experience, you may
want to contact a Microsoft Certified Partner or the Microsoft fee-based
consulting line at (800) 936-5200. For more information about Microsoft Certified
Partners, please visit the following Microsoft Web site:
https://partner.microsoft.com/global/30000104
(https://partner.microsoft.com/global/30000104)
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS
(http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)
Using the Word.Basic ObjectThe following VBScript automation code illustrates the problem using the Word.Basic object.
VBScript Code Status
--------------------------------------------------------------
Set Word = Item.Application.CreateObject("Word.Basic") 'OK
Word.FileNewDefault 'OK
Word.FileOpen "C:\test.doc" 'OK
Word.AppShow 'Error
Word.EditGoTo "test" 'Error
Word.Insert "test" 'Error
Word.InsertPara 'Error
Word.InsertDateTime 'OK
Word.FileExit 'Error
Using the Word.Application ObjectThe following VBScript automation code illustrates the problem using the Word.Application object.
VBScript Code Status
-----------------------------------------------------------------------
Set Word = Item.Application.CreateObject("Word.Application") 'OK
Word.Visible = True 'OK
Word.Documents.Add 'OK
Word.Selection.TypeText "This is a test and will error." 'Error
Summary of ProblemsVBScript Word.Basic Word.Basic Word.Application Word.Application version in Word 95 in Word 97 in Word 97 in Word 97 SR-1 ------------------------------------------------------------------------ 1.0 Errors Errors OK OK 2.0 Errors Errors OK OK 3.0 OK OK Errors OK REFERENCES
For more information about creating solutions with Microsoft Outlook 97,
please see the following articles in the Microsoft Knowledge Base:
166368
(http://support.microsoft.com/kb/166368/EN-US/
)
OL97: How to Get Help Programming with Outlook
170783
(http://support.microsoft.com/kb/170783/EN-US/
)
OL97: Q&A: Questions about Customizing or Programming Outlook
For more information about automating Microsoft Word 95, please see
the following article in the Microsoft Knowledge Base:
161547
(http://support.microsoft.com/kb/161547/EN-US/
)
How to Use OLE Automation with Word 6.0/7.0
APPLIES TO
| Article Translations
|


Back to the top
