Jump to content

VBA Code not working


smuthuc

Recommended Posts

Please the below VBA code not working

please correct this one

 

Public Sub Draw_Bpoly()

Dim p As Variant
p = ThisDrawing.Utility.GetPoint(, "First the Point:")
Dim p1(1) As Double
p1(0) = p(0)
p1(1) = p(1)
ThisDrawing.SetVariable "osmode", 0
ThisDrawing.SendCommand "_.-boundary" & vbCr & "_A" & vbCr & "_I" & vbCr & "_N" & vbCr & vbCr & vbCr & p1 & vbCr

End Sub

 

thanking you...:roll:

Edited by SLW210
Code Tags
Link to comment
Share on other sites

I'm not an AutoCAD VBA user and do not have it installed but I would think that p should be dimensioned as an array and not a plain variant. For example,

 

Dim p(0 To 2) As Double

Link to comment
Share on other sites

Public Sub Draw_Bpoly()
Dim p As Variant
Dim pstr As String
p = ThisDrawing.Utility.GetPoint(, "Pick the inner point of boundary")
pstr = Replace(CStr(p(0)), ",", ".") & "," & Replace(CStr(p(1)), ",", ".")
ThisDrawing.SendCommand Chr(3) & Chr(3) & "_.-boundary" & vbCr & pstr & vbCr & vbCr
End Sub

Link to comment
Share on other sites

Thanking you....

 

i used yours code. but i is showing invalid input....

 

but i changed little things and it will work well once again thanking....

 

Public Sub Draw_Bpoly()

Dim p As Variant
Dim pstr As String
p = ThisDrawing.Utility.GetPoint(, "Pick the inner point of boundary")
pstr = Replace(CStr(p(0)), ",", ".") & "," & Replace(CStr(p(1)), ",", ".")
ThisDrawing.SendCommand  "_.-boundary" & vbCr & pstr & vbCr & vbCr

End Sub

Edited by SLW210
Code Tags
Link to comment
Share on other sites

Thanking you for your kind replys.......

 

i used your advice even i will show type mismatch

 

then i got solution from others like you i will work well

 

Public Sub Draw_Bpoly()

Dim p As Variant
p = ThisDrawing.Utility.GetPoint(, "First the Point:")
ThisDrawing.SetVariable "osmode", 0
ThisDrawing.SendCommand "_.-boundary" & vbCr & "_A" & vbCr & "_I" & vbCr & "_N" & vbCr & vbCr & vbCr & p(0) & "," & p(1) & vbCr & vbCr

End Sub

 

thanking you...

Edited by SLW210
Code Tags
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...