Author Topic: Macro in Excel  (Read 3242 times)

0 Members and 1 Guest are viewing this topic.

HofCAD

  • Guest
Macro in Excel
« on: September 20, 2006, 02:33:31 PM »
Hello CAD friends,

Is it possible to make a macro and a macrobutton in Excel with VisualLisp.
I would like to make the Excel file HOFCADLT.XLS  with VisualLisp.

Thanks in advance!

Regards,
HofCAD CSI.
« Last Edit: September 21, 2006, 12:00:11 PM by HofCAD »

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: Macro in Excel
« Reply #1 on: September 20, 2006, 02:35:49 PM »
Can you explain why you want to do this?

At least what you're going to use the Excel file for...

HofCAD

  • Guest
Re: Macro in Excel
« Reply #2 on: September 20, 2006, 02:50:27 PM »
Can you explain why you want to do this?

At least what you're going to use the Excel file for...

Dear Greg,

The file HofCADLT.xls demonstrates the Dynamic Data Exchange(DDE) method, and I would like to link VisualLisp to these method.
See:
DDE
HOFCADLT.XLS 
Regards,
HofCAD CSI.
« Last Edit: September 21, 2006, 01:10:35 PM by HofCAD »

Maverick®

  • Seagull
  • Posts: 14778
Re: Macro in Excel
« Reply #3 on: September 21, 2006, 12:09:05 PM »
  Forgive my ignorance.

  From looking at the links you put up I'm guessing this is for using some custom applications written in VB or LISP in ACAD LT.  (Which to my understanding doesn't support automation like this)  Is this right? Did I just spout all kinds of gibberish?

  If not then how about an explanation like that?  "One can use this to do this or that"  For us folk who don't know what it is for.

Maverick®

  • Seagull
  • Posts: 14778
Re: Macro in Excel
« Reply #4 on: September 21, 2006, 12:13:25 PM »
And maybe a more descriptive thread title.  "Using DDE to automate Acad LT" or something like that. 

You posted pretty much the exact same thing here. So I don't know why you are reposting the same thing.

  Is there a question?

Greg B

  • Seagull
  • Posts: 12417
  • Tell me a Joke!
Re: Macro in Excel
« Reply #5 on: September 21, 2006, 12:19:19 PM »
If you are in Acad you can access an excel file with vlisp.  This seems to be what you are trying to accomplish.  I thought I've seen different examples through out this forum of people accessing excel tables.


Now if you are trying to just use excel and write a macro within it without anything from autocad coming into play, I'd suggest just using vba.

HofCAD

  • Guest
Re: Macro in Excel
« Reply #6 on: September 21, 2006, 01:14:47 PM »
If you are in Acad you can access an excel file with vlisp.  This seems to be what you are trying to accomplish.  I thought I've seen different examples through out this forum of people accessing excel tables.


Now if you are trying to just use excel and write a macro within it without anything from autocad coming into play, I'd suggest just using vba.

Dear Greg and Maverick®,

With visuallisp you can make a file in Excel HOFCADLT.XLS and users can change that Excel file, it would be nice that they can activate AutoCAD for an update with an Excel macrobutton.
Then you have a two way of communication (bidirectional).

Specific example :
1)VisualLisp is writing a spreadsheet for development of a cone.
2)Users make there choice in diameters and height in that spreadsheet.
3)Then they click on the macrobutton 'Update' and then they get the development  in AutoCAD.

Another advantage is: That when you write the macro with VisualLisp, Lisp
can decide  for ChannelNr = Application.DDEInitiate("AutoCAD.r16.dde", "System") or  ChannelNr = Application.DDEInitiate("AutoCAD.r17.dde", "System"), which is
necessary for working in AutoCAD 2006 or AutoCAD 2007

I think :oops: : "If it is possible in VBA, then it is also possible in VisualLisp", because I saw the writing of an hyperlink with VisualLips into Excel
(Saving an hyperlink to an Excel cell from Patrick_35)
.
There for the question is still: Is it possible to make a macro and a macrobutton in Excel with VisualLisp?

Regards,
HofCAD CSI.

PS1
Change the green values in HOFCADLT.XLS and use the yellow macrobutton Update, and look to the result in AutoCAD.

PS2
May be you have to change at the top of the macro's:
Const ver As Integer = 16
Const arr As String = "-ARRAY"

PS3
Sorry for my English.


« Last Edit: September 22, 2006, 08:52:59 AM by HofCAD »

sinc

  • Guest
Re: Macro in Excel
« Reply #7 on: September 22, 2006, 05:03:20 PM »
I think :oops: : "If it is possible in VBA, then it is also possible in VisualLisp", because I saw the writing of an hyperlink with VisualLips into Excel
(Saving an hyperlink to an Excel cell from Patrick_35)
.

Not necessarily.  VisualLisp is pretty capable, but it is not really a full-featured language.  Plus, the Active-X access is kind of wishy-washy.  There are times when you may try to use it in what should be a completely acceptable way, and your Lisp routine will simply stop running.  It doesn't error out, you can't use the vl-catch-all stuff or anything.  It's not because of a problem with your code.  It's a flaw in the internal Lisp implementation.  One microsecond your program is running just fine, and the next microsecond...  poof!  You're staring at a blank Autocad command prompt.

I'm having a hard time figuring out what you want to do.  Do you have someone drawing something in Autocad?  Then you want a VLisp routine to create an Excel workbook with parameters for elements in the Autocad drawing?  Then someone else can change the Autocad drawing by editing the Excel workbook?