+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 29
  1. #1
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Dec 2009
    Posts
    11

    Default Control Word with visual lisp

    Registered forum members do not see this ad.

    Hi,
    can anyone help me with this?
    i want to write in certain place in the middle of a microsoft word document.



    Thanks
    Last edited by Montinho; 17th Dec 2009 at 12:18 am.

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    4,008

    Default

    AutoLISP / VisualLISP are languages supported by AutoCAD (and other CAD related software). To customize Word (or other Office tools) should pay attention to VBA (Visual Basic for Applications) language which is derived from Visual Basic with tools specific for each application where is implemented.
    Use associated help with confidence since is very well structured and writhed or search for support on a related site/forum. Good luck!

    Regards,

  3. #3
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Thanks God, I'm far enough from Hitleropa
    Posts
    1,697

    Default

    Quote Originally Posted by Montinho View Post
    Hi,
    can anyone help me with this?
    i want to write in certain place in the middle of a microsoft word document.



    Thanks
    Lisp or VBA?

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  4. #4
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Dec 2009
    Posts
    11

    Default

    I can do a lot of things inside excel, write cells, change color font, delete rows and columns, delete sheets, hide sheets, all this throught visual lisp, and all this i discovered mostly by myself, testing and reading a few bits of this and that site.
    But i find it very weird that i can do this, but found little documentation on the subject.
    When you start writing vlax-xxxxxxx, you get a lot of functions. Yes there are a few tutorials that have a few functions explained, but not all, but on this area of activex controls for visual lisp i never found anything.
    On microsoft word i can write on a new document, or on this or that paragraph, but something is missing.
    I'm sure someone knows about it, someone always does, please give that little help that i need.

  5. #5
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Thanks God, I'm far enough from Hitleropa
    Posts
    1,697

    Default

    Quote Originally Posted by Montinho View Post
    I can do a lot of things inside excel, write cells, change color font, delete rows and columns, delete sheets, hide sheets, all this throught visual lisp, and all this i discovered mostly by myself, testing and reading a few bits of this and that site.
    But i find it very weird that i can do this, but found little documentation on the subject.
    When you start writing vlax-xxxxxxx, you get a lot of functions. Yes there are a few tutorials that have a few functions explained, but not all, but on this area of activex controls for visual lisp i never found anything.
    On microsoft word i can write on a new document, or on this or that paragraph, but something is missing.
    I'm sure someone knows about it, someone always does, please give that little help that i need.
    Let me expalin what I understand
    Do you want to find particular word inside and
    then replace it with other one?
    Or you need to add word into the certain place
    without finding for the match word?
    Say add empty paragraph and the add the word
    Post a picture and we can start working something out

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  6. #6
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Dec 2009
    Posts
    11

    Default

    fixo, you're the man with the knowledge

    i want write a word in a certain place.

  7. #7
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Thanks God, I'm far enough from Hitleropa
    Posts
    1,697

    Default

    Quote Originally Posted by Montinho View Post
    fixo, you're the man with the knowledge

    i want write a word in a certain place.
    Play around this one
    You can easily write your own user defined function
    I called them 'helpers'

    Code:
    ;;demo.lsp
    ;; helpers
    (defun write_to_end  (wrdapp text / endrange)
      (setq	endrange
    	 (vlax-get-property
    	   (vlax-get-property
    	     (vlax-get-property
    	       (vlax-get-property wrdapp 'ActiveDocument)
    	       'Paragraphs)
    	     'Last
    	     )
    	   'Range
    	   )
    	)
      (vlax-invoke-method endrange 'InsertAfter text)
      )
    
    (defun write_to_place  (wrdapp num text / endrange)
      (setq	endrange
    	    (vla-item (vlax-get-property
    	       (vlax-get-property wrdapp 'ActiveDocument)
    	       'Sentences) num
    		      )
    )
    (vlax-invoke-method endrange 'InsertAfter text)
    )
    ;; main prog
    (defun C:demo(/ docname  wrdapp wrddoc wrddocs wrdrange)
      (setq	docname (getfiled "Select Word Document"
    			 (getvar "dwgprefix")
    			 "doc;dot;*"
    			 16))
      (alert "Wait For Closing Word Application")
      (setq wrdapp (vlax-get-or-create-object "Word.Application"))
      (vla-put-visible wrdapp :vlax-true)
      (vlax-put-property wrdapp 'ScreenUpdating :vlax-false)
      (setq wrddocs (vlax-get-property wrdapp 'Documents))
      (vlax-invoke-method wrddocs 'Open docname :vlax-false)
      (setq wrddoc (vlax-get-property wrdapp 'Activedocument))
      (vlax-invoke-method wrddoc 'Activate)
      (write_to_end wrdapp  "Now it is the last line in the document" )
      (write_to_place wrdapp  2 "Now it is the first sentense in the second line in the document" )
          (vlax-put-property wrdapp 'ScreenUpdating :vlax-true)
        (vlax-invoke-method
          wrddoc
          'Saveas
          docname
          )
        (vlax-invoke-method wrddoc 'Close)
        (vlax-invoke-method wrdapp 'Quit)
        (mapcar (function (lambda (x)
    			(vl-catch-all-apply
    			  (function (lambda ()
    				      (progn
    					(vlax-release-object x)
    					(setq x nil)
    					)
    				      )
    				    )
    			  )
    			)
    		      )
    	    (list wrddoc wrddocs wrdapp)
    	    )
      (gc)
      (princ)
      )
    
    (prompt
      "\n\t\t>>>\tType DEMO to execute\t<<<"
    )
    (prin1)
    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  8. #8
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Dec 2009
    Posts
    11

    Default

    FIXO, you the man!!!

    but how do you know all this, is there any book, tutorial, manual whatever with all this?

  9. #9
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Thanks God, I'm far enough from Hitleropa
    Posts
    1,697

    Default

    Quote Originally Posted by Montinho View Post
    FIXO, you the man!!!

    but how do you know all this, is there any book, tutorial, manual whatever with all this?
    I use Macro->Write Macro in Word/Excel VBA then convert
    VBA code on Lisp nothing else
    For every object I get properties/methods with help of:
    Code:
    (vlax-dum-object obj T)
    and also I spent a lot of time to know all these things

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  10. #10
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Dec 2009
    Posts
    11

    Default

    Registered forum members do not see this ad.

    Fixo,

    How do you convert vba code in lisp?

Similar Threads

  1. Visual Lisp Reference Charts
    By The Buzzard in forum AutoLISP, Visual LISP & DCL
    Replies: 18
    Last Post: 15th Apr 2013, 07:21 am
  2. no experience with auto/visual LISP
    By AAONCAD in forum AutoLISP, Visual LISP & DCL
    Replies: 32
    Last Post: 12th Aug 2009, 08:55 pm
  3. using VBA Forms with visual lisp
    By erdurmaz in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 30th Dec 2008, 09:16 pm
  4. Lineweight Control in Microsoft Word
    By alfred corbin in forum AutoCAD Drawing Management & Output
    Replies: 5
    Last Post: 18th Sep 2008, 02:35 pm
  5. Visual Lisp Text
    By nauggie in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 5th Oct 2006, 12:28 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts