Jump to content

learning vba


Gringo

Recommended Posts

hey guys im trying to learn vba

 

i already know a fair bit about lisp but want to move into vba

 

would someone be able to show me how to do the following in vba??

 

;1
(defun c:test ()
(princ)
)

;2
(setq dscl (getvar "dimscale"))

;3
(setvar "dimscale" 1)

4;
(command "-linetype" "_s")

;5
(alert(strcat "\nthis is a test"))

 

I just want to see how the simple things work in vba

 

thanks

Link to comment
Share on other sites

Sub Test()
Dim vVar as variant 'Is a variant in case assigned to text or number
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
vVar = ThisDrawing.GetVariable ("DIMSCALE")
ThisDrawing.SetVariable "DIMSCALE" , 1# 'lb sign included if no decimal
ThisDrawing.SendCommand "-LINETYPE" & vbCr & "S" & vbCr & "ByLayer" & vbCr & vbCr
ThisDrawing.Utility.Prompt "this is a test"

End Sub

 

oops..
If you want a pop up box  it is...
MsgBox "this is a test"

Link to comment
Share on other sites

thanks.

 

It healps heaps when transferring from lisp to VBA

 

A couple more requests

 


(setq ss1 (ssget "x"))


(setq EntN (ssname ss1 1))
(setq EntL (entget EntN))
(setq EntT (cdr (assoc 0 EntL)))
(setq EntC (assoc 62 EntL))

(setq ss2 (ssadd))

(if (not EntC)
(ssadd EntN ss2)
);if




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