VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error opening files..

3 REPLIES 3
Reply
Message 1 of 4
yvesallaire2562
492 Views, 3 Replies

Error opening files..

Hi,

 

This is usually an easy task, but now I'm not able to see what could be wrong!!!

 

Here is the simple code:

 

Dim fileName As String, path As String, ObjDWG As AcadDocument
    path = "C:\Temp\geotic\Tiri\"
    fileName = Dir(path & "*.dwg")
    ThisDrawing.Application.Documents.Open (path & fileName)

 

I see that Autocad (2011) is trying to open the file up to some point, then Error -2145386153 (80200157)

 

I can open the file manually without any problem, note that the file I'm trying to read is from a third party software

If I save the file with autocad and try to open it with VBA... still crash.

 

No problem with a native drawing

 

A sample is attached.

3 REPLIES 3
Message 2 of 4
Hallex
in reply to: yvesallaire2562

Check this before:

 

MsgBox Dir(path & "*.dwg")

 

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 4
yvesallaire2562
in reply to: Hallex

Hi,

 

I solved the problem, I have FME a software I use to translate files, (same software used by inside autocad) and it to saved all my files to DXF.

 

But I ran into another problem, with an another method.

.saveas...

 

        fileName = fileName & ".dwg"
        'fileName = path & "3D\" & fileName
         ThisDrawing.SaveAs fileName, ac2007_dwg

 

If I try to do the saveas to a different folder it crashes... simply saveas to the default folder it works!!!???

 

this is why I've put a remark in front of the second line above!

 

Thanks.

Message 4 of 4
Hallex
in reply to: yvesallaire2562

Try to use:

fileName = path & "\3D\" & fileName

 

Not sure about thogh just a shot in the dark

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost