I have one VBA that will not find the gpk file. Using the same code that works on the other VBA. Below is the code from the example which is used to check. The result returns the path/jobjob104.gpk
Dim jobNums() As String Dim count As Integer Dim myCogo As Cogo
'Array of Job Numbers jobNums() = GetJobNumbersWithinActiveDir()
For count = LBound(jobNums) To UBound(jobNums) 'Get the first Job Number in the array If 0 = count Then 'Set the active Job Number Set myCogo = OpenCogoByJobNumber(104) 'Set myCogo = OpenCogoByJobNumber(jobNums(count))
If (myCogo Is Nothing) Then MsgBox "error reading job: " & jobNums(count) Else MsgBox myCogo.FullFileName End If
End If
Next count
Larry WilsonLWilson@LJBinc.com
Hi Larry,
could you please execute this code below and send us the output of the debug statements - thank you in advance.
Artur
Option Explicit Sub COGO_SetActiveJobNumber() Dim jobNums() As String Dim count As Integer Dim myCogo As Cogo 'Array of Job Numbers jobNums() = GetJobNumbersWithinActiveDir() For count = LBound(jobNums) To UBound(jobNums) 'Get the first Job Number in the array If 0 = count Then 'Set the active Job Number Set myCogo = OpenCogoByJobNumber(104) ' Set myCogo = OpenCogoByJobNumber(jobNums(count)) ' Geopak GPK active dir location logic: Dim arrCfgVars() As Variant Dim cfg As Variant arrCfgVars = Array("GPK_JOBDIR", "GPK_CWD", "_DGNFILE") For Each cfg In arrCfgVars If (ActiveWorkspace.IsConfigurationVariableDefined(cfg)) Then Debug.Print cfg & ": " & ActiveWorkspace.ConfigurationVariableValue(cfg, True) Else Debug.Print cfg & ": " & "NOT DEFINED" End If Next Debug.Print "Cogo.FullFileName: " & myCogo.FullFileName If (myCogo Is Nothing) Then MsgBox "error reading job: " & jobNums(count) Else MsgBox myCogo.FullFileName End If End If Next count End Sub