Automate Publish command in 2004

Discussion in 'AutoCAD' started by Jon Hargett, Aug 5, 2003.

  1. Jon Hargett

    Jon Hargett Guest

    Is there a way to automate the new Publish command using VBA? I would like
    to create dwf's from an AutoCAD 2004 drawing so that all of the layouts in
    the drawing are in one dwf file. The new dwf file format allows more than
    one page in the file. The publish command is able to do this, but I have not
    found a way to automate it through VBA. Any ideas?

    Jon
     
    Jon Hargett, Aug 5, 2003
    #1
  2. Jon Hargett

    Jimmy B Guest

    Jimmy B, Aug 5, 2003
    #2
  3. Jon Hargett

    Jon Hargett Guest

    Thanks, I have been trying to use this since you mentioned it. However,
    whenever I issue this command from VB, I get an "Unhandled Access Violation"
    in AutoCAD. Here is what the command looks like:
    doc.SendCommand "-PUBLISH" & vbCr & "temp.dsd" & vbCr

    If I run the VB program and set a break point right before this command, and
    then type it in to AutoCAD manually, it works. But if I let it run, I get
    the violation.
     
    Jon Hargett, Aug 6, 2003
    #3
  4. Jon Hargett

    Jimmy B Guest

    This is how you can use it:

    (initdia)
    (command "-PUBLISH" "c:\\temp\\temp.dsd")

    Don't know if it will help. If you still get crashes try to use SendKeys or
    SendMessage(Handle, WM_CHAR, lChar, 0) instead.

    --
    Best Regards, Jimmy B
    CAD and Database Developer Manager at www.pharmadule-emtunga.com
    Take a look at the trial version of SmartPurger (now for AutoCAD 2004) or
    download some freeware at www.jtbworld.com
    More on AutoCAD 2004;
    www.jtbworld.com/autocad2004.htm
    www.jtbworld.com/autocad2004tips.htm
     
    Jimmy B, Aug 6, 2003
    #4
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.