VBA SendCommand Trouble

Discussion in 'AutoCAD' started by TomD, Jul 14, 2004.

  1. TomD

    TomD Guest

    I've posted a message on Adesk's VBA NG, too, relating to this
    problem, though I've narrowed to something I find terribly strange and
    have not been able to even think of a possible workaround. Any
    thoughts appreciated.

    The offending code:

    sDsd = "c:\windows\temp\cecdwflogtemp.dsd"
    ThisDrawing.Save
    sCmd = "-PUBLISH" & vbCr & DsdFileName & vbCr
    ThisDrawing.SendCommand sCmd '<<BOMS HERE

    Resulting error:

    FATAL ERROR: Unhandled Access Violation Reading 0x655f778 Exception at
    62d2eab0h

    Odd thing about this is that if I simply remove the vbCr (carriage
    return) from the end of the sCmd variable, it runs fine.

    sCmd = "-PUBLISH" & vbCr & DsdFileName
    ThisDrawing.SendCommand sCmd '<<Works Fine

    This creates the DWF, as it should, with no trouble, but the user is
    required to press enter, which we all know cannot be counted on.

    I'm happy to humor ANY serious thoughts about this, no matter how
    half-baked they may seem. (I've tried sending the vbCr via a separate
    call to SendCommand....no good.)

    PS Hope all the regulars are well. I'm hoping to be back much more
    often, again, soon.
     
    TomD, Jul 14, 2004
    #1
  2. TomD

    TomD Guest

    I resolved this problem by using SendKeys instead of
    ThisDrawing.SendCommand. The final result looked something like:

    ThisDrawing.SendCommand "-PUBLISH" & vbCr & sFileName
    SendKeys "{ENTER}"

    It works fine this way.
     
    TomD, Jul 20, 2004
    #2
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.