Experiencing several "Filer Error" Runtime Errors in AutoCAD 2007
Hi all,
I've been experiencing several "Filer Error" Runtime Errors when using VBA Macros in AutoCAD 2007. The macros are used for inserting blocks and the .InsertBlock method is getting the error. If I change the block name in the code, get another error, select debug, and change the name back to the correct name it works fine. The same code works perfectly in 2006. Does anyone have any ideas on what the issue may be? Any work arounds?
Thanks!
MC
RE: Experiencing several "Filer Error" Runtime Errors in AutoCAD 2007
I was able to resolve the issue by using this code:
Code:
''FindFile by Bob Wahr now of theSwamp.org, as found on cadvault.com
Public Function FindFile(strFile As String)
'Dimension Variables
Dim strSupPth As String
Dim varPaths As Variant
Dim intCnt As Integer
Dim strFnd As String
Dim strTest As String
Dim strDwgDir As String
'Get path information
strSupPth = ThisDrawing.GetVariable("acadprefix")
strDwgDir = ThisDrawing.GetVariable("dwgprefix")
strTest = Dir(CurDir & "\" & strFile, 31)
'Search for file sequentially in path information.
If strTest <> "" Then
strFnd = CurDir & "\" & strTest
Else
strTest = Dir(strDwgDir & "\" & strFile, 31)
If strTest <> "" Then
strFnd = strDwgDir & "\" & strFile
Else
If strSupPth <> "" Then
varPaths = Split(strSupPth, ";", -1, vbTextCompare)
For intCnt = 0 To UBound(varPaths)
strTest = Dir(varPaths(intCnt) & "\" & strFile, 31)
If strTest <> "" Then
strFnd = varPaths(intCnt) & "\" & strFile
Exit For
End If
Next intCnt
End If
End If
End If
FindFile = strFnd
End Function
This code builds the complete file path for the desired file and outputs a string with that data. It can be used to open drawings, insert blocks, etc. This seems to apease the appetite of whatever ACAD 07 is looking for. Since I started using this I haven't had the error anymore.
Hope this helps!
MC
RE: Experiencing several "Filer Error" Runtime Errors in AutoCAD 2007
i think im a little too new to VBA to incorporate that code into my existing project ... is there any way to detect a filer error before it occurs?
the FindFile routine that I am using has a Const variable MAX_LEN set at 260. Is there a reason for this specific number? Would that be causing the filer error? Would anything be hurt by increasing this number to, say, 300?
Thanks for all your suggestions!
RE: Experiencing several "Filer Error" Runtime Errors in AutoCAD 2007
Quote:
Originally Posted by rcrabb
i think im a little too new to VBA to incorporate that code into my existing project ... is there any way to detect a filer error before it occurs?
the FindFile routine that I am using has a Const variable MAX_LEN set at 260. Is there a reason for this specific number? Would that be causing the filer error? Would anything be hurt by increasing this number to, say, 300?
Thanks for all your suggestions!
All that is necessary to use the code would be to paste it into a module and then use the function. For example:
dim strFile as string
strFile = mdlTest.FindFile("Test.dwg")
You could then use the resulting value of strFile for any use requiring a file of any type. I'm not aware of any other fixes to the issue. It's not a syntax or code issue so much as it is a bug in the software that came with 2007. It's quite frustrating. If I remember correctly the Autodesk forums have some good threads on the topic.
Sorry I couldn't be of more help.
MC
RE: Experiencing several "Filer Error" Runtime Errors in AutoCAD 2007
Quote:
Originally Posted by mcoffman
All that is necessary to use the code would be to paste it into a module and then use the function. For example:
dim strFile as string
strFile = mdlTest.FindFile("Test.dwg")
You could then use the resulting value of strFile for any use requiring a file of any type. I'm not aware of any other fixes to the issue. It's not a syntax or code issue so much as it is a bug in the software that came with 2007. It's quite frustrating. If I remember correctly the Autodesk forums have some good threads on the topic.
Sorry I couldn't be of more help.
MC
no, you have been a great help! i just didn't understand how to use that function, I am sorry! I am running a batch right now, as soon as it finishes, ill add in your function and try again - i'll post the results here - thank you so much!
RE: Experiencing several "Filer Error" Runtime Errors in AutoCAD 2007
the file giving me the error was not a valid file ... :lol: thats why it gave me the error
i guess i need to write an ERR_CHECKER in case the file can't be opened or something