AnsweredAssumed Answered

Retrieving the COM class factory...failed due to the following error: 80080005

Question asked by shankar.ecgit on Jan 16, 2015
Latest reply on Jan 22, 2015 by shankar.ecgit
Branched from an earlier discussion

Hello Everyone,

 

I am also attempting to do something similar.

 

I am trying to open a processbook via a PI ACE class module, and am saving it as jpg, and then e-mailing the saved file.


The code works fine when we debug - but during run time . ie.  I get the below error .. I have also shared the code so that anyone can help me debug it

 

Retrieving the COM class factory for component with CLSID {7BFECD80-1B23-101C-B28E-00AA0022EF07} failed due to the following error: 80080005.

 

        

        Dim myProcessBookapp As New PBObjLib.Application

        Dim sSenderId As String

        Dim myPISDK As PISDK.PISDK

        Dim RootModule As PIModule

        Dim pTriggerTag As PIPoint

        myPISDK = New PISDK.PISDK

        Dim zDebugFile As String

        Dim sb As New StringBuilder()

        Dim myPB As New PBObjLib.Display

 

        zDebugFile = "E:\AutoMail_" + Replace(Replace(Replace(Replace(Replace(Now, "\", ""), ":", ""), "#", ""), "/", ""), " ", "") + ".txt"

        sb.AppendLine("Trigger Tag : " & TriggerTag.Value)

        If TriggerTag.Value = 1 Then
            RootModule = PIACEBIFunctions.GetPIModuleFromPath(Context)
            sSenderId = RootModule.PIProperties("ToEmail").Value

            myPB = myProcessBookapp.ProcBooks.Open("E:\Screen1.PDI", False)
            myProcessBookapp.ActiveDisplay.Height = 780
            myProcessBookapp.ActiveDisplay.Width = 1100
            'myProcessBookapp.ActiveDisplay.Scroll(0, 0, 0, 100, 10, 10)
            myProcessBookapp.ActiveDisplay.Scroll(0, -140)

            myProcessBookapp.ActiveDisplay.SaveAs("E:\Page-1.jpg", PBObjLib.pbpdFILEFORMAT.pbpdFormatJPEG)

            sb.AppendLine("First Page is Saved")

            myPB = myProcessBookapp.ProcBooks.Open("E:\Screen2.PDI", False)
            myProcessBookapp.ActiveDisplay.Height = 780
            myProcessBookapp.ActiveDisplay.Width = 1000
            'myProcessBookapp.ActiveDisplay.Scroll(0, 0, 0, 100, 10, 10)
            myProcessBookapp.ActiveDisplay.Scroll(0, -180)

 

            myProcessBookapp.ActiveDisplay.SaveAs("E:\Page-2.jpg", PBObjLib.pbpdFILEFORMAT.pbpdFormatJPEG)

            sb.AppendLine("Second Page is Saved")
            myPB.Close(False)

            myProcessBookapp.Quit()
            SendMailOneAttachment("E:\Page-1.jpg", "Page-2.jpg", sSenderId)

            sb.AppendLine("E Mail is Sent")


        End If

        Using outfile As New StreamWriter(zDebugFile)
            outfile.Write(sb.ToString())
        End Using

 

 

Outcomes