Visual basic program for linking Autrocad & Excel

Visual basic program for linking Autrocad & Excel

Anonymous
Not applicable
470 Views
1 Reply
Message 1 of 2

Visual basic program for linking Autrocad & Excel

Anonymous
Not applicable

I'm new to visual basic and dont know much about programming

 

I'm looking for a program that can help link together an excel table and an AutoCAD drawing, where if I plug a number into the excel cell it will automatically change a property shape in the AutoCAD drawing to a certain color. I will need 10 different colors and there will be several property shapes containing a number inside it to identify it.

 

 

For example: In excel: If I plug in the following values into my cell box;

 

Property Number     Color Value          Property Shape in Autocad      

    

      200                          1                  Property turns green in Autocad     

      300                          2                  Property turns red in Autocad     

      400                          1                  Property turns green in Autocad

 

Also i am not sure whether to download visual basic, visual basic applications , or visual basic editor for what i need?

 

 

0 Likes
471 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable

Hi ,

long time ago I write this code to open excel file and read search some cellsvalues

 

'Connect to Excel************************************************************
Dim xlApp As Object
Dim xlWSheet As Worksheet
Dim xlRange As Range

Set xlApp = CreateObject("excel.application")
xlApp.Visible = False
xlApp.Workbooks.Open Filename:=DB_path & DB_file
Set xlWSheet = xlApp.Workbooks(DB_file).Sheets("DB")
Set xlRange = xlWSheet.Columns(1)

ReDim Preserve tabella(t - 1, 13)
PTOT = 0

'Cerco il codice nel DB
On Error Resume Next
For c1 = 0 To UBound(tabella)
    DBpos = xlRange.Find(tabella(c1, 0), , , , , , True).Row
    For c2 = 3 To 12
        tabella(c1, c2) = xlRange.Cells(DBpos, c2)
    Next c2
    If tabella(c1, 12) = "" Then tabella(c1, 12) = 0
    tabella(c1, 13) = Str(Int(tabella(c1, 2) * tabella(c1, 12) * 10) / 10)
    PTOT = PTOT + Val(tabella(c1, 13))
Next c1
On Error GoTo 0

'Disconnect Excel****************************************************
xlApp.Visible = True
Set xlRange = Nothing
Set xlWSheet = Nothing
xlApp.Application.Quit

Set xlApp = Nothing

 if you have more question pls cotact me

0 Likes