Ahankhah Posted August 11, 2010 Share Posted August 11, 2010 Hi, I am writing a visual lisp program, invoking Microsoft Excel to make modificatins in an existing .xlsx fle. How can I put a hyperlink text inside a cell? Mehrdad Ahankhah Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted August 11, 2010 Share Posted August 11, 2010 (edited) code removed Edited August 11, 2010 by Lt Dan's legs Quote Link to comment Share on other sites More sharing options...
MSasu Posted August 11, 2010 Share Posted August 11, 2010 @Lt Dan's legs: Absolutely NO! By opening an Excel file (a formatted file) in text mode you will destroy it! Check on the forum, there are already examples regarding Excel file access from AutoLISP available. Regards, Quote Link to comment Share on other sites More sharing options...
Lt Dan's legs Posted August 11, 2010 Share Posted August 11, 2010 WOW, did not know that! Sorry Ahankhah and thanks for the heads up msasu Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 11, 2010 Share Posted August 11, 2010 I'm not sure I completely understand your question Ahankhah: do you wish to link two text items in AutoCAD & Excel so that if one is modified, the change is reflected in the other? Or are you merely looking to copy a text item to Excel? Or use a hyperlink in AutoCAD to open Excel? Quote Link to comment Share on other sites More sharing options...
Ahankhah Posted August 12, 2010 Author Share Posted August 12, 2010 I'm not sure I completely understand your question Ahankhah: do you wish to link two text items in AutoCAD & Excel so that if one is modified, the change is reflected in the other? Or are you merely looking to copy a text item to Excel? Or use a hyperlink in AutoCAD to open Excel? Lee Mac, I found the solution of my instant problem, but you mentioned to the subsequent question of me. Do you know how I can link a text in a cell of excel spreadsheet to some information about an drawing:?? For instance, am I able to show the number of lines in a drawing in an excel file, so that when the number changes the text in excel spreadsheet changes to the new amount:huh:? I hope I could express my idea:unsure:! Mehrdad Ahankhah www.irancad.com Quote Link to comment Share on other sites More sharing options...
Ahankhah Posted August 13, 2010 Author Share Posted August 13, 2010 (edited) Lt Dan's legs, although msasu is right, you gave me the clue. Here is my code using your offer: (vl-load-com) (setq excel (vlax-create-object "Excel.Application") workbooks (vlax-get-property excel 'Workbooks) workbook (vlax-invoke-method workbooks 'Open "test.xls") sheet (vlax-get-property excel 'Activesheet) cells (vlax-get-property sheet 'Cells) data '("This" "is" "an" "example" "of" "inserting" "text" "and" "hyperlink" "in" "excel" "spreadsheet:" "=HYPERLINK(\"cadtutor.net\";\"cad tutor\")" ) ) (setq row 1) (setq column 0) (foreach item data (setq column (1+ column)) (vlax-put-property cells 'Item row column item) ) (vlax-invoke-method workbook 'Save) (vlax-invoke-method workbooks 'Close) (vlax-invoke-method excel 'Quit) (vlax-release-object cells) (vlax-release-object sheet) (vlax-release-object workbook) (vlax-release-object workbooks) (vlax-release-object excel) (gc) I appreciate your help and want to thank you:D. Edited August 16, 2010 by Ahankhah changed , to ; in the code: "=HYPERLINK(\"cadtutor.net\";\"cad tutor\")" Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 14, 2010 Share Posted August 14, 2010 Lee Mac, I found the solution of my instant problem, but you mentioned to the subsequent question of me. Do you know how I can link a text in a cell of excel spreadsheet to some information about an drawing:?? For instance, am I able to show the number of lines in a drawing in an excel file, so that when the number changes the text in excel spreadsheet changes to the new amount:huh:? I hope I could express my idea:unsure:! Mehrdad Ahankhah www.irancad.com Hmm.. a tough one - a reactor springs to mind, but it wouldn't be easy to implement. Unless there is a way to somehow accomplish this with fields... 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.