Gringo 发表于 2022-7-6 17:25:06

学习vba

嘿,伙计们,我正在努力学习vba
 
我已经对lisp有了相当多的了解,但我想进入vba
 
有人能告诉我如何在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"))

 
我只是想看看vba中简单的东西是如何工作的
 
谢谢

borgunit 发表于 2022-7-6 18:23:28


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 boxit is...
MsgBox "this is a test"

Gringo 发表于 2022-7-6 18:28:12

谢谢
 
当从lisp转换到VBA时,它会堆叠堆
 
还有几个请求
 


(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




页: [1]
查看完整版本: 学习vba