See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: !!! VBA Excel problems with file path consisting spaces when sending command to Autocad

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2024-05
    Posts
    1
    Login to Give a bone
    0

    Default !!! VBA Excel problems with file path consisting spaces when sending command to Autocad

    I coding VBA excel to send commands Insert blocks to Autocad.
    Filename contains block is C:/Tu Tool/Rebar Detailing/Rebar Detail Block/EUROCODE/Type 21/Type 21-D12.dwg
    4156257d-e3b2-40b5-931c-9665863a0fa4.png
    However autocad interpret the SPACE in file path as Enter in command line ?
    445f3209-a17b-45b1-82c0-5663859e45fa.png
    So have you got any ideas to handle these problems
    Much thanks

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,167
    Login to Give a bone
    1

    Default Re: !!! VBA Excel problems with file path consisting spaces when sending command to Autocad

    Surround the path with an additional set of quotes.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,526
    Login to Give a bone
    0

    Default Re: !!! VBA Excel problems with file path consisting spaces when sending command to Autocad

    Quote Originally Posted by Opie View Post
    Surround the path with an additional set of quotes.
    That won't work. You have to add the extra quote with either an escape character or a third set of quotes. See the examples below. Also, you either need to use vbLf or vbCrLf. vbCr just issues a carriage return.

    ThisDrawing.SendCommand "_insert" & vbCrLf &"""C:\\some path with spaces\\filename,dwg"""

    or

    ThisDrawing.SendCommand "_insert" & vbCrLf &""C:\\some path with spaces\\filename,dwg""
    C:> ED WORKING....


    LinkedIn

Similar Threads

  1. Replies: 0
    Last Post: 2018-10-07, 02:12 PM
  2. Replies: 5
    Last Post: 2013-10-16, 05:39 PM
  3. Sending Commands to Command Line From Modal Form
    By Ivan.Markov.206575 in forum Dot Net API
    Replies: 1
    Last Post: 2009-07-23, 02:50 PM
  4. Detail in Revit and developments consisting every year
    By varnergiuntoli in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2007-06-17, 06:50 PM
  5. Sending text to a printer in VBA (how?)
    By mbeebe9691 in forum VBA/COM Interop
    Replies: 1
    Last Post: 2004-06-09, 06:52 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
  •