open or publish in AutoCAD 2004 vba

Discussion in 'AutoCAD' started by S Robbens, Jun 18, 2004.

  1. S Robbens

    S Robbens Guest

    I'm trying to batch publish a group of drawings in AutoCAD 2004 vba.
    I've made a DSD-file and I would like to publish it every night to
    DWF.I've wrote a very little program:

    Sub Multiple_Publish()
    ThisDrawing.SendCommand "filedia" & vbCr
    ThisDrawing.SendCommand "0" & vbCr
    ThisDrawing.SendCommand "-PUBLISH" & vbCr
    ThisDrawing.SendCommand "\\SERVER4\SPFM\SPEEDFM\AQUARE_A3.DSD" & vbCr
    End Sub

    The strange thing is, if run the same vba-procedure and leave the last
    ENTER out, then I manually place the enter in the command line it
    works perfectly. If I send the last ENTER using VBA(& vbCr) it autoCAD
    crashes:

    FATAL ERROR: Unhandled Access Violation Reading 0xdacf778 Exception at
    62d2e8aah

    I've investigted the problem and found out that autoCAD can't open a
    drawing from vba:

    Sub Multiple_Publish()
    ThisDrawing.SendCommand "open" & vbCr
    ThisDrawing.SendCommand "AALTER00.dwg" & vbCr
    End Sub

    FATAL ERROR: Unhandled Access Violation Reading 0x0004 Exception at
    44da25h

    What ame I to do? Is there something wrong with my code or is it a
    known AutoCAD problem?

    TIA
     
    S Robbens, Jun 18, 2004
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.