Visual Basic Customization

Visual Basic Customization

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

Error opening files..

250 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 (242 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 (240 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 (209 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
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.