VLISP to Excel

Discussion in 'AutoCAD' started by Alan Henderson, Apr 1, 2004.

  1. I spent many hours today trying to learn how to write data to the Current
    Active Cell in the Current Active Excel Sheet.
    I went through the NG, searched the Internet and read the VLISP help files.

    (setq XLAP (vlax-get-object "Excel.Application"))
    (setq XLAC (vlax-get-property XLAP 'ActiveCell))
    (setq NTXT "TEST")
    (setq VTXT (vlax-make-variant NTXT vlax-vbString))
    (vlax-put-property XLAC 'Text VTXT)
    ;returns - error: ActiveX Server returned an error: Type mismatch

    I'm not sure where I'm going wrong.
    Thanks in advanced.
    Alan
     
    Alan Henderson, Apr 1, 2004
    #1
  2. Alan Henderson

    hendie Guest

    try this:

    (setq XLAP (vlax-get-object "Excel.Application"))
    (setq XLAC (vlax-get-property XLAP 'ActiveCell))
    (setq NTXT "TEST")
    (setq VTXT (vlax-make-variant NTXT vlax-vbString))
    (vlax-put-property XLAC 'VALUE VTXT)


    BTW how did you get my name ?
     
    hendie, Apr 2, 2004
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.