+ Reply to Thread
Results 1 to 19 of 19

Assistance Needed Formatting Autocad to Excel Lisp Routine

  1. #1
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Assistance Needed Formatting Autocad to Excel Lisp Routine

    Hello. Attached I have a code for an AutoCAD Lisp routine that takes Excel information and puts it into Autocad. I'm trying to format it so that I can actually use it but I've been at it an hour now and my coding abilities just flat out suck. I would greatly appreciate if anyone would be willing to help me with this. I know this is something that you do in 5 minutes (or maybe some of you do, idk). I'm kind of up a creek right now though. Code is attached and Path information is below if you're willing to help. Please and thank you.

    Path: C:\Users\WilliaC2\Desktop\Excel\BuildMyBOM(test).xlsm
    Sheet: BOM
    Cell Range: C7:H7
    Attached Files Attached Files
    Last edited by Jim Clayton; 06-19-2018 at 12:54 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,887

    Re: Have Code-Need Help Formatting It

    Welcome to the forum! Please take a moment to re-read forum rule #1 and then amend your thread title to something that better explains your problem. Changing your thread title is not optional, which means you must change it. Thanks!

    Use concise, accurate thread titles.
    Your post title should describe your problem, not your anticipated solution.
    Use terms appropriate to a Google search - poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice tell us nothing.
    Responding to a request to change your thread title by doing so is mandatory.

    To change a title go to your first post, click EDIT then Go Advanced and change your title.

    No help to be offered, please, until the OP complies with this request.

    When you have changed the title, please also give full details of the problem in the body of your post - nobody should have to open an attachment to find out what you want.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Also, to cut off further delay include the sample file.

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  4. #4
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Sample Excel file that is being transferred and Cad File with attribute layout (same as C7:H7 since you may not have AutoCAD). Any help is greatly appreciated. Tks.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Correction-Cad file invalid and would not load. Just the Code from the first post and Sample Excel book from the last post. Tks.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Try compressing the CAD file and uploading it. Hopefully it will be readable, so we know what format you are trying to translate from / to.

  7. #7
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    One compressed AutoCAD file attached, per request. TKs.
    Attached Files Attached Files

  8. #8
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Alas, I cannot decipher the format of the dwg file. Is there some sort of import / export format you are trying to match?

  9. #9
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Have attached PDF of the AutoCAD format. This corresponds with the Excel sheet data. The Code on the first post is supposed to load the Excel data into AutoCAD once it's formatted accordingly (Path, Sheet, Range). I'm unable to achieve the formatting portion.
    Attached Files Attached Files

  10. #10
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    I took the liberty of doing a couple of things to your workbook based on my understanding of the requirement. I didn't change much so if I got it wrong, it should be easy to fix.

    First I made a table out of the data on the BOM sheet. I also made a table out of your data and reset the source data to it. Excel tables have many benefits but the one that is most important here is that Excel Tables know how big they are. So as you clear data and copy and paste in new data, the pivot table will know exactly how much data it has to reference regardless of how many rows wind up in the table. A similar concept works for the BOM sheet: the table contains only as much data as it needs.

    Here is more information on Excel Tables: http://www.utteraccess.com/wiki/Tables_in_Excel.

    On the BOM sheet I changed the macro that the Reset Button runs. It empties the table (again, tables know how big they are).

    On the BuildMyBOM sheet, I checked out the Reset Button. It appears to work. I noticed that the BOM button is assigned to a macro that doesn't exist. I changed the code behind the Add To BOM button. It takes the selected line on the BuildMyBOM worksheet and adds it to the BOM.

    Which brings me back to the BOM sheet. I have several questions:
    - BOM Line: the code copies over the BOM line from the BuildMyBOM sheet. Do you want this to be sequential instead, starting with 1?
    - Apparently the requirement is to export the BOM sheet so it can be imported elsewhere. What format (XLSX, CSV, etc.) do you want this, and do you have a preference for a file name?
    - Do you want the column headers to reflect what you sent in the PDF?
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Hello and thanks for the help. Let me go down try and go down the list.
    - Button on the “BuildMyBOM” Sheet with the phantom macro: You’re Correct. This is currently under construction, and was there at one point in time but didn’t work.
    -Changing the Data sheet to a table: Not sure if this is the source of the issue or not, but something, possibly this, is causing my “Add To BOM” Button to no longer function. Rather than trying to copy cells D7:H7 and paste it to the “BOM” sheet, it’s now trying to copy C3:H3, which is blank.
    -BOM Line: I’d like to maintain the current setup where the BOM Line # is not being copied over that way when I go to insert this into a drawing it’s 1-10 rather than 1,23,14,18,etc. Think that’s what you’re asking.
    -Exporting: This is where I really have no clue. I’m using it to change Autocad attributes. I know this can be achieved in long form by saving/importing it as a .txt file. So that may be the preferred route if possible.
    -Column Headers: Not entirely clear on what you’re asking here but I’ll do my best to answer. I don’t want the headers transferred over, only the cell values. The information in the PDF is essentially the same, just worded slightly different. On the actual drawings it’s nothing but hyphens waiting to be filled in.
    Again I very much appreciate you taking the time to help.

  12. #12
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    I changed the data sheet into a table as a matter of efficiency. There was no issue with it not being a table, but making it a table makes the application more maintainable.

    I made a slight mod. The BOM now comes out numbered 1, 2, 3, etc. regardless of the number on the main form.

    I'll finish up tomorrow. I'll assume that what you need is a comma-separated-variable file (CSV) - that's a very common format for import / export.

    In the meantime, you can play with this version.
    Attached Files Attached Files

  13. #13
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    What is the name of the program you are working with? Maybe I can get some information about import formats on line.

  14. #14
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Excel 2010, AutoCAD 2014. Not sure if that's what you're looking for. Thanks again for the help though.

  15. #15
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    This link: https://knowledge.autodesk.com/suppo...9-to-2012.html

    Shows the type of files that can be imported into autocad. The only one I can support is PDF, so I will design to that. I know almost nothing about AutoCad, but I am assuming that it will import the PDF so it can be "attached" to a drawing.

    I should have it shortly.

  16. #16
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Here it is. I will explain in the next post when I can figure out what part of the text is causing the post to be rejected.
    Attached Files Attached Files

  17. #17
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Click on the Build My BOM rectangle and you will be prompted for a file name. Filenames cannot have certain characters like slash or asterisk or colon and several others. I happen to have a routine on hand that cleans these out. You will be show the clean file name for confirmation. The PDF File will be created in the same directory as the workbook.

  18. #18
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    Judging from what I read in the AutoCad documentation, this will come in as a "picture" that can be added to a drawing. In this case, you probably do want the BOM table headers. That is what I programmed in. If it turns out that you just want the data (no headers),
    Change
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.
    I had to put spaces between the code and the brackets to keep the censoring software from blocking this post. Type out what you see without the spaces or copy and paste and then remove the spaces.

  19. #19
    Forum Contributor
    Join Date
    02-12-2018
    Location
    TX
    MS-Off Ver
    MS Office 2019
    Posts
    305

    Re: Assistance Needed Formatting Autocad to Excel Lisp Routine

    I very much appreciate all the help and time spent on this. Have only had the chance to glance at it briefly because I'm tied up with work at the moment, but will look at it more in depth here in a bit when a get a free minute. Again, appreciate all your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA code to convert all data + formatting of entire sheet to VBA code
    By jocanon in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-14-2016, 06:56 PM
  2. Tool or code to copy VBA code to OneNote or Word while preserving VBA formatting
    By gregersdk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2015, 04:07 PM
  3. help with code formatting
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2015, 06:47 PM
  4. [SOLVED] Userform TextBox Problem... formatting code clears data instead of formatting
    By michaeljoeyeager in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-26-2012, 11:00 AM
  5. Zip code formatting
    By SRPitera in forum Excel General
    Replies: 6
    Last Post: 09-22-2009, 11:03 AM
  6. VB code for formatting
    By lostinformulas in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-06-2006, 09:20 PM
  7. Zip Code Formatting
    By JWCrosby in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 07-01-2006, 08:55 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1