Results 1 to 5 of 5

Thread: VBA Open and Close Drawing

  1. #1
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Smile VBA Open and Close Drawing

    Hello AUGI Members:

    I am relatively new to visual basic for applications and have a simple VBA batch plotting routine I developed to plot in-house drawings. The program works fine for our needs except when someone has a drawing or two open that I am trying to batch plot. When this occurs the routine stops and waits for you to answer the prompt to open the drawing as Read Only.

    I basically want to know if there is a way to eliminate this from happening so the batch plot will run in an uninterrupted manner....??

    I also have a another question about closing drawing files using the same VBA program. I am using the following line of code to close each drawing file:

    ###Code Start
    ThisDrawing.Application.ActiveDocument.Close

    It does close the drawing but it also saves the file and I really want to close the drawing file without saving it. Is there any way to accomplish this....??

    Any suggestions or recommendations would be appreciated....!!

    Regards,
    Vince

  2. #2
    Member
    Join Date
    2002-11
    Posts
    19
    Login to Give a bone
    0

    Default Re: VBA Open and Close Drawing

    Try using
    ThisDrawing.Application.ActiveDocument.Open (true)
    This will open the drawing in read only all the time so it will stop the prompt

    ThisDrawing.Application.ActiveDocument.Close (false)
    will close the drawing without saving

  3. #3
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Re: VBA Open and Close Drawing

    Thank you for your quick response.....!!

    When I try to add (true) to it I get a compile error.

    ThisDrawing.Application.Documents.Open (True) DwgDir & lstSelect.List(count) & ".dwg"

    However, the ThisDrawing.Application.ActiveDocument.Close (False) line of code works OK.

    Do you have any suggestions.....!!!

    Regards,
    Vince

  4. #4
    Member
    Join Date
    2002-11
    Posts
    19
    Login to Give a bone
    0

    Default Re: VBA Open and Close Drawing

    I'm sorry, I don't know what I was thinking. This is what you need, if you already have variables set up for these then you can sustitute.

    Application.Documents.Open DwgDir & lstSelect.List(count) & ".dwg", True

  5. #5
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Re: VBA Open and Close Drawing

    That did the trick.....The routine appears to be working fine.....!!!

    Once again, thank you for you expert solution to my question.

    Regards,
    Vince

Similar Threads

  1. Replies: 10
    Last Post: 2023-01-24, 06:27 PM
  2. Replies: 7
    Last Post: 2018-04-13, 03:57 AM
  3. open, print, then close
    By rken.laws in forum AutoLISP
    Replies: 10
    Last Post: 2010-03-03, 06:42 PM
  4. API to open with audit then close
    By ron.sanpedro in forum Revit - API
    Replies: 1
    Last Post: 2007-07-14, 11:27 PM
  5. Open, Zoom Extents and Close
    By JASONM30395 in forum AutoLISP
    Replies: 11
    Last Post: 2005-05-03, 05:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •