Jim Clayton Posted July 18, 2018 Author Share Posted July 18, 2018 Osnaps have been checked. Maybe it's something on my end. It's pasting all 3 rows fine now 80% of the time. Then there is a small percentage that either skips a row or stacks the rows on top of each other. Let me check for inconsistencies on my end. I appreciate all of your help. This will be a massive improvement. Tks. Quote Link to comment Share on other sites More sharing options...
rlx Posted July 18, 2018 Share Posted July 18, 2018 Osnaps have been checked. Maybe it's something on my end. It's pasting all 3 rows fine now 80% of the time. Then there is a small percentage that either skips a row or stacks the rows on top of each other. Let me check for inconsistencies on my end. I appreciate all of your help. This will be a massive improvement. Tks. Normaly I would have used vla-insert and reference to the attribute tags cause now program uses command function and is dependend of the attribute order. So no room for error. But thats what you get with a quicky... Quote Link to comment Share on other sites More sharing options...
Jim Clayton Posted July 18, 2018 Author Share Posted July 18, 2018 It's light years beyond what I'm working with now, so I'll take it. I appreciate all the help. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 19, 2018 Share Posted July 19, 2018 rlx you have almost answered a little problem I am having. 1 I need to check 1st no excel open so open BIGAL.xls that's ok 2 I check is excel open yes is one of the work books BIGAL.xls if No open BIGAL.xls 3 same as 2 but change to BIGAL.xls as it is already open, (setq activeworkbook (vlax-invoke-method workbooks 'open "Filename")) This gives a user warning that it is "already open" I want to run invisibly open excel change a couple of cells and re save. I tried 'Activate 'Currentworkbook etc I know it will be a word or double method I can not find it. I appreciate the workbooks has a count of items so wether its as case of setting the correct item. Quote Link to comment Share on other sites More sharing options...
rlx Posted July 19, 2018 Share Posted July 19, 2018 (edited) rlx you have almost answered a little problem I am having. 1 I need to check 1st no excel open so open BIGAL.xls that's ok 2 I check is excel open yes is one of the work books BIGAL.xls if No open BIGAL.xls 3 same as 2 but change to BIGAL.xls as it is already open, (setq activeworkbook (vlax-invoke-method workbooks 'open "Filename")) This gives a user warning that it is "already open" I want to run invisibly open excel change a couple of cells and re save. I tried 'Activate 'Currentworkbook etc I know it will be a word or double method I can not find it. I appreciate the workbooks has a count of items so wether its as case of setting the correct item. would have to do some tests myself but have to meet a deadline today so I hope I have some time to spare but I would probably start with : (vlax-put-property xls-app 'visible :vlax-false) (vlax-put-property xls-app 'ScreenUpdating :vlax-false) (vlax-put-property xls-app 'DisplayAlerts :vlax-false) but have noticed excel doesn't always do what you expect or it's supposed to do. maybe something here : https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/handling-excel-files-silently-from-a-network-location/td-p/7285319 Finally figured this one out so I'm back to share. I thought by setting the DisplayAlerts to false would disable all alerts while the document was active, instead it appears that flag settings appears to be limited to the command being executed and its done, in this case opening the excel. By adding the same disable alert flag with the CloseExcel sub-routine the files closed silently as desired. gr.Rlx Edited July 19, 2018 by rlx Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 19, 2018 Share Posted July 19, 2018 (edited) I realise now that I need to google excel VBA switch workbooks, then convert to vl. There should be an answer. Found it looking at excel VBA a couple of hints though the workbook name is case sensitive, if it has not not been saved then it will not have a .xlsx etc as part of name eg "Book2" not "Book2.xlsx" . I will put together a brief example of checking for excel and what workbooks are open as per my previous post. Changing sheets is covered in the Rlx code, the one I want has 24 sheets. ; refer Rlx code (vlax-for wb workbooks (If (= (vla-get-fullname wb) "test.xlsx")(vlax-invoke-method wb 'activate)) ) Edited July 20, 2018 by BIGAL Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 20, 2018 Share Posted July 20, 2018 Back to original post and a one size fits all it can be done with a global routine, the only issue is that the excel spreadsheet has to have an identifier at the end of the attribute data say something like "~" this way the data can vary for the number of attributes per block. Other methods like read howmanyatts in a column would work also. This would also allow for blank entries in attributes. "Blockname" "att1" "att2" "~" "Blockname" "att1" "att2" "att3" "att4" "~" "Blockname" "att1" "~" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.