1 Reply Latest reply on Sep 18, 2012 3:50 AM by wimdecorte

    ActiveX(VisualBasic6.0 App) sometimes fail

    petit

      ActiveX(VisualBasic6.0 App) sometimes fail

       

       

      Environment:FileMakerPro11 + Windows7

       

       

      The code is to acquire an active fileName from the FileMakerFiles.

      But sometimes fail at Specific code

       

       

      Usually the error doesn't work until rebooting OS

       

       

      VB Err.Number is unknown.

       

       

      The code is below

      Error occurs somewhere in 4 lines between ▲&▼

      (sorry, I do not know where the err occur in 4 Lines,

      Because I cannot reoccur it again either)

       

       

      It is unclear that Why and When the error occurs.

      Please show me the solution or the factor.

       

       

       

       

      Dim FMApp As FMPRO70Lib.Application

      Dim FMDocs As FMPRO70Lib.Documents

      Dim FMActiveDoc As FMPRO70Lib.Document

       

       

      Dim myOpenFile As Object 'Opened FileMaker File

      Dim strOpenFilePath As String 'Path

       

       

      'Get Opened FileMaker Object

      Set FMApp = GetObject("", mstrFILEMAKER_APP)

       

       

      Set FMDocs = FMApp.Documents

       

       

      ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼

      'Acquire Active File Name

      Set myOpenFile = FMDocs.Active

      'Show APP

      FMApp.Visible = True

       

       

      Set FMActiveDoc = FMDocs.Active

      strOpenFilePath = FMActiveDoc.FullName

      ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲

       

       

      Msgbox strOpenFilePath

       

       

      ’Clear Objects

      Set FMDocs = Nothing

      Set FMActiveDoc = Nothing

      Set myOpenFile = Nothing

      Set FMApp = Nothing