Unable to cast COM object error in SSIS
- From: squidier <squidier@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Aug 2006 13:02:02 -0700
Hi.
From within SQL Server 2005 SSIS, I'm just trying to open a Word doc andsave it as .txt using a Script Task. I've added the
Microsoft.Office.Interop.Word assembly as per
http://msdn2.microsoft.com/en-us/library/ms136007.aspx and receive the
following error when I attempt to execute the Script Task containing the code
below. I've looked all over for a solution but to no avail. Please help! :)
Squidier
Unable to cast COM object of type
'Microsoft.Office.Interop.Word.ApplicationClass' to interface type
'Microsoft.Office.Interop.Word._Application'. This operation failed because
the QueryInterface call on the COM component for the interface with IID
'{00020970-0000-0000-C000-000000000046}' failed due to the following error:
No such interface supported (Exception from HRESULT: 0x80004002
(E_NOINTERFACE)).
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.Vsa
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.Office.Interop.Word
Public Class ScriptMain
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables,
events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to
indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.
Public Sub Main()
Dim wdApp As Microsoft.Office.Interop.Word.Application
Dim docNew As Microsoft.Office.Interop.Word.Document
Dim wrdConverter As Microsoft.Office.Interop.Word.FileConverter
'' Create new hidden instance of Word.
wdApp = New Microsoft.Office.Interop.Word.ApplicationClass()
'' Create a new document.
docNew =
wdApp.Documents.Open("H:\CSMOReporting\RemediationTracker\OfficeConverter\ADRAP Report - Baptist Healthcare.doc")
'docNew.SaveAs(FileName:="H:\CSMOReporting\RemediationTracker\OfficeConverter\ADRAP Report - Baptist Healthcare.txt", _
'
FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatText)
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
.
- Prev by Date: Include file doesn't work with SSIS 2005 XML Task ?
- Next by Date: RE: Novice: How to modify rows (not add) using a script component
- Previous by thread: Include file doesn't work with SSIS 2005 XML Task ?
- Next by thread: Re: How to run a ssis package from .net code in 32-bit mode on a 64bit
- Index(es):
Relevant Pages
|