Jump to content

I know this has been asked a thousand times....


Jim Clayton

Recommended Posts

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.

Link to comment
Share on other sites

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • Jim Clayton

    13

  • BIGAL

    5

  • rlx

    5

  • guitarguy1685

    2

Top Posters In This Topic

Posted Images

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 by rlx
Link to comment
Share on other sites

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 by BIGAL
Link to comment
Share on other sites

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" "~"

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...