Visual Basic Customization

Visual Basic Customization

Reply
New Member
yvesallaire2562
Posts: 2
Registered: ‎02-03-2009
Message 1 of 4 (256 Views)

Error opening files..

256 Views, 3 Replies
03-06-2012 01:35 PM

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.

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 4 (248 Views)

Re: Error opening files..

03-06-2012 10:25 PM in reply to: yvesallaire2562

Check this before:

 

MsgBox Dir(path & "*.dwg")

 

 

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
New Member
yvesallaire2562
Posts: 2
Registered: ‎02-03-2009
Message 3 of 4 (246 Views)

Re: Error opening files..

03-07-2012 05:20 AM 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.

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 4 of 4 (215 Views)

Re: Error opening files..

03-19-2012 01:53 AM in reply to: yvesallaire2562

Try to use:

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

 

Not sure about thogh just a shot in the dark

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!