Exchange Forum > ActiveX and VBA
VBA values to AutoLISP
Page 1 of 3
1 2 3
VBA values to AutoLISP

#1

Dante
Join Date:
08-13-2007
I'm new to VBA. I have created a VBA dialog form with the information for my project which is in AutoLISP code.
It's too difficult for me to convert my AutoLISP code in VBA at this point.
How can I link my VBA values with my AutoLISP code?
VBA values to AutoLISP

#2

CadBrowser
Join Date:
09-25-2007
As far as I know you cannot tell your lisp to control a VBA controlled GUI. Basically you would have to create a DCL that mimics the VBA and control that with LISP.
 
If you like you can send me the VBA and your LISP so I can look it over and possibly help you with converting it to VBA.
VBA values to AutoLISP

#3

J Moreno
Join Date:
07-30-2007
I'm sure there may be a more efficient way to accomplish what you are trying to do. But, I would suggest while in VBA writing your VBA values out to a text file, and then have your AutoLISP function read in the text file and setq your AutoLISP values.
VBA values to AutoLISP

#4

Dante
Join Date:
08-13-2007
I don't know where to go after the Accept button is clicked. Attached is an image of my project and the VBA dvb code.
Here is the text version.
Code:
Option Explicit 'frmBorderInfo
'-------- UserForm_Initialize --------
Private Sub UserForm_Initialize()
  cboCountry.List = Array("", "USA", "Canada")
  cmdAccept.SetFocus
End Sub 'UserForm_Initialize
'-------- cmdClear_Click --------
Private Sub cmdClear_Click()
  txtOrder.Text = ""
  txtGroup.Text = ""
  txtCustomer.Text = ""
  txtProject.Text = ""
  txtLocation.Text = ""
  txtArchitect.Text = ""
  txtContractor.Text = ""
  txtInitials.Text = ""
  cboCountry.Text = ""
End Sub 'cmdClear_Click
'-------- cmdAccept_Click --------
Private Sub cmdAccept_Click()
  End
End Sub 'cmdAccept_Click
'-------- cmdCancel_Click --------
Private Sub cmdCancel_Click()
  CancelYesNo
End Sub 'cmdCancel_Click
 
'-------- txtOrder_Change --------
Private Sub txtOrder_Change()
  txtOrder.Text = UCase(txtOrder.Text)
End Sub 'txtOrder_Change
'-------- txtGroup_Change --------
Private Sub txtGroup_Change()
  txtGroup.Text = UCase(txtGroup.Text)
End Sub 'txtGroup_Change
'-------- txtCustomer_Change --------
Private Sub txtCustomer_Change()
  txtCustomer.Text = UCase(txtCustomer.Text)
End Sub 'txtCustomer_Change
'-------- txtProject_Change --------
Private Sub txtProject_Change()
  txtProject.Text = UCase(txtProject.Text)
End Sub 'txtProject_Change
'-------- txtLocation_Change --------
Private Sub txtLocation_Change()
  txtLocation.Text = UCase(txtLocation.Text)
End Sub 'txtLocation_Change
'-------- txtArchitect_Change --------
Private Sub txtArchitect_Change()
  txtArchitect.Text = UCase(txtArchitect.Text)
End Sub 'txtArchitect_Change
'-------- txtContractor_Change --------
Private Sub txtContractor_Change()
  txtContractor.Text = UCase(txtContractor.Text)
End Sub 'txtContractor_Change
'-------- txtInitials_Change --------
Private Sub txtInitials_Change()
  txtInitials.Text = UCase(txtInitials.Text)
End Sub 'txtInitials_Change
'-------- CancelYesNo --------
Public Sub CancelYesNo()
  Dim intReturn As Integer
  intReturn = MsgBox("Are you sure you want to Cancel?", vbQuestion + vbYesNo, " AutoCAD Message")
  If intReturn = vbYes Then
    Dim Form As Object
    For Each Form In UserForms
      With Form
        Unload Form
      End With
    Next
    End
  End If
End Sub 'CancelYesNo



Attachments  BorderInfo.gif    BorderInfo.dvb  
VBA values to AutoLISP

#5

CadBrowser
Join Date:
09-25-2007
Well Dante, it depends on what you want to do with the information once it is entered in.
 
You can send the info to a database, insert that data into the titleblock, or you can create a block that contains this information as attributes and store it in the drawing. Then when you want to retrieve it for later use, viola! It is right there for you.
 
What was it that your AutoLISP routine did with this information?
VBA values to AutoLISP

#6

Dante
Join Date:
08-13-2007
Initially I want to be able to populate a title block with the information. But later on after I get more advanced, I want to do other things with the VBA data, such as draw objects etc. When the user selects the Accept button, this is where I need it to save or send the data back to AutoCAD.
I appreciate your help.
VBA values to AutoLISP

#7

CadBrowser
Join Date:
09-25-2007
Dante, In order to make sure I can manipulate the VBA correctly I'll need to know what version of AutoCAD are you using, because I have 2002 here at work, and 2007 at home.
 
Also please attach the titleblock you wish to add this data to, and I will try to work up a simple program that sends the info from the form you created to the title block. I will also try to provide tutorial type commenting to the code so that you can see how it was done.
 
Be advised, it may take me a little while (couple days) to get the finished product to you as I don't have a lot of personal time (oldest son plays football, web site maintenance, and etcetera). So if you can be patient, I can help you out with this.
VBA values to AutoLISP

#8

Dante
Join Date:
08-13-2007
The block attribute tags are the same names as the labels in the VBA form. However, I don’t feel it is in my company’s best interest to send in our title block, if you know what I mean. I really like working here! I mainly need just a little guidance to get started to send the values back to AutoLISP. Thanks for your help.
VBA values to AutoLISP

#9

CadBrowser
Join Date:
09-25-2007
Ok that is fine. I understand that some companies can be a little unforgiving when it comes to sharing info.
 
Ok some of the info I'm going to give you comes out of a great book I got called AutoCAD 2000 VBA Programmer's Reference by Joe Sutphin.
 
A couple of questions first:
 
Will the user be inserting the titleblock and then filling out this information via your VBA form, or will the block be there already and the user will just fill it in and the titleblock need be updated?
 
Also, do you have anything set up for when the user may need to modify that information, do you want a command to tell that form to retrieve the info from the titleblock, or do you want the user to just use the ddatte command to modify the info?
 
What i'm going to do is set up a form just like yours and use it on my companies titleblock and then point you in the right direction.
 
Also I am wondering, what values do you need to send back to AutoLISP? That statement confused me.
VBA values to AutoLISP

#10

Dante
Join Date:
08-13-2007
Sorry for the confusion, but this is basically all I am trying to accomplish in my project at this point. I'm not that advanced in VBA yet.
 
(setvar "attreq" 1)
(command "insert" "Border-C" "0,0" "1" "1" "0" Order Group Customer Project Location Architect Contractor Initials Country)
Page 1 of 3
1 2 3