Home Image-Pro General Discussions
Options

ThisApplication.ActiveDocument.DisplayName

All --

I have a set of files on my computer that includes

.VB FILE
.IPP FILE

When I run the code within these files on my computer, all is well.

When I run the code within these files on a customer's computer, PREMIER 9.1.4 (same version as mine) displays the following error

ActiveX Automation: Object var is 'Nothing'.
[C:\OPAL IMAGE ANALYSIS PROGRAM\OPAL SEAL V1B\OPAL SEAL PROJECT V1B.ipp>C:\OPAL IMAGE ANALYSIS PROGRAM\OPAL SEAL V1B\OPAL SEAL MODULE V1B.vb|testing#1311] Debug.Print ThisApplication.ActiveDocument.DisplayName

Since the REFERENCES and IMPORTS should be the same because the IPP and VB files are the same, what would keep the CUSTOMER'S COMPUTER from properly handling this the

    ThisApplication.ActiveDocument.DisplayName

Thanks.

-- Matt


Best Answer

  • Options
    Answer ✓
    Matt,

    Is it a run-time error? Can it be that Premier doesn't have any documents opened? That would explain "Object var is 'Nothing'" error as ActiveDocument would be Nothing.

    Yuri

Answers

  • Options
    Yuri --

    Thank you for your response.

    Looking back through the code to consider your input I found the following code section that tries to activate the ORIGINAL IMAGE if it is already open within PREMIER.

        Private Function OPAL_ActivateOriginalImage() As Boolean
    
            'Build the DISPLAY NAME for the ORIGINAL IMAGE
            Dim var1 =
                Replace (OPAL_OriginalImageFullFileName,OPAL_OriginalImageFolder & "\","")
    
            'Attempt to ACTIVATE the ORIGINAL IMAGE
            With Application.DocumentCommands.Activate(Nothing)
                .Run(var1, ThisApplication.ActiveDocument)
            End With
    
            'If the ACTIVE IMAGE is not the ORIGIONAL IMAGE
            If (ThisApplication.ActiveDocument.DisplayName <> var1) _
                Then
    
                    'Then return the appropriate value through the FUNCTION
                    OPAL_ActivateOriginalImage = False
    
                Else
    
                    'Then return the appropriate value through the FUNCTION
                    OPAL_ActivateOriginalImage = True
    
                End If
    
        End Function
    On my computer, this works fine but on the customer's computer I think the

                .Run(var1, ThisApplication.ActiveDocument)
    

    is setting the

                ThisApplication.ActiveDocument
    

    to nothing and mangling the flow.

    I'll revise this on my machine and then test it on both machines and see if this resolves the issue.

    Thanks for pointing me in what I think will be the right direction.

    -- Matt





Sign In or Register to comment.