Author Topic: Displaying info from excel files  (Read 4495 times)

0 Members and 1 Guest are viewing this topic.

JJaetzold

  • Guest
Displaying info from excel files
« on: March 21, 2006, 08:05:45 PM »
First Post

Im ok with autocad,  but a 1 week old novice at VBA.

I want combobox1 to display information from an excel file.  I know this is possible,  but The book I have tells me very little about this.  I have made a few attempts at it with no success.  Any advice would be greatly appreciated.

oh,  by the way,  I have no idea what I am doing.

nivuahc

  • Guest
Re: Displaying info from excel files
« Reply #1 on: March 21, 2006, 08:20:40 PM »
Welcome to TheSwamp JJaetzold :)

oh,  by the way,  I have no idea what I am doing.

When it comes to VBA, I'm in the same boat. There are, however, lots of people here who do things that amaze me with VBA and I'm sure you'll find the help you seek.

In the meantime, consider introducing yourself in this thread and have a look around. You also might want to consider using the forum search. Who knows? Maybe someone has already tackled this problem! :)

Again, welcome to TheSwamp

- Chuck

MickD

  • Gator
  • Posts: 3420
  • (x-in)->[process]->(y-out)
Re: Displaying info from excel files
« Reply #2 on: March 21, 2006, 08:29:25 PM »
Welcome to the Swamp!
Also have a look at Kenny's site (AfraLisp), he has many excellent examples to get you started with excel and access etc. in vba.
http://www.afralisp.co.za/
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

Jim Yadon

  • Guest
Re: Displaying info from excel files
« Reply #3 on: March 21, 2006, 09:30:11 PM »
Did you find what you were looking for?

JJaetzold

  • Guest
Re: Displaying info from excel files
« Reply #4 on: March 21, 2006, 10:15:49 PM »
Did you find what you were looking for?

Not yet,  still kind of digging in between bathing kiddos and honey do's.  Any advice is welcome.  I am still trying to figure out how to put everything in sequence.  I can build forms and make them switch between each other and put in some basic function.  I am lost as where to put certain subs and how to call them up.  I assume the code will go into the module and then somehow reference the data to the combobox.  That is my best guess so far anyway.

JJaetzold

  • Guest
Re: Displaying info from excel files
« Reply #5 on: March 21, 2006, 10:30:02 PM »
Welcome to the Swamp!
Also have a look at Kenny's site (AfraLisp), he has many excellent examples to get you started with excel and access etc. in vba.
http://www.afralisp.co.za/

ok,  I got some good stuff from the afra site,  I will have to look over it in the morning to see what i can sort out.   

Thanks for the info guys,  and keep it coming.

Jim Yadon

  • Guest
Re: Displaying info from excel files
« Reply #6 on: March 22, 2006, 04:57:23 AM »
Keep us posted. I am going to be working on a small project in Excel that will require populating lists (my data source is outside Excel). As I recall from the last time I did a data project like the one I'm on now, it's not a big stretch from a list to a combo. The only real difference I see would be the iteration methods for building the lists. If you like we can compare notes/methods as we go.

jonesy

  • SuperMod
  • Seagull
  • Posts: 15535
Re: Displaying info from excel files
« Reply #7 on: March 22, 2006, 06:29:09 AM »
Also there is a VBA course here, run by one of the swamp members. see this board

You could contact CmdrDuh, I'm pretty sure the course is still open.

Kind regards
Tracey
Thanks for explaining the word "many" to me, it means a lot.

Troy Williams

  • Guest
Re: Displaying info from excel files
« Reply #8 on: March 22, 2006, 07:45:03 AM »
First Post

Im ok with autocad,  but a 1 week old novice at VBA.

I want combobox1 to display information from an excel file.  I know this is possible,  but The book I have tells me very little about this.  I have made a few attempts at it with no success.  Any advice would be greatly appreciated.

oh,  by the way,  I have no idea what I am doing.

Where abouts do you want the combo box located? In excel or AutoCAD?

JJaetzold

  • Guest
Re: Displaying info from excel files
« Reply #9 on: March 22, 2006, 08:28:37 PM »
The box will be in Cad.  I made the user form and have some of the really basic stuff down.  I would prefer the user to be able to pick from the combobox.  I want the combobox to contain data that is retrieved from excel.  So far I am not having any luck.  I was pretty busy today so I didn't spend much time with it. 

I will check out the vba class also.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10388
Re: Displaying info from excel files
« Reply #10 on: March 23, 2006, 08:39:53 AM »
Welcome to theSwamp Josh.
I don't do VBA but there are lots of knowledgeable folks here that do.
Enjoy
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Jim Yadon

  • Guest
Re: Displaying info from excel files
« Reply #11 on: March 23, 2006, 08:43:32 PM »
Unfortunately I am not writing my code from within ACAD. I am writing from within Excel. :-(

Off the top of my head I'd say you need to establish a class to access the data within the workbook/worksheet then utilze the follwing code to set the data within the combo. If I have time when I'm done with what I'm working on I'll noodle around a bit. I'm sure someone else has something that'd be more helpful though.
Code: [Select]
Private Sub UserForm_Initialize()
  cmbMyCombo.RowSource = [set your cell range here]
  cmbMyCombo.ControlSource = [set the control where the data you want to show here]
End Sub

*oops, corrected my code*
« Last Edit: March 23, 2006, 09:01:18 PM by JAY »

Jim Yadon

  • Guest
Re: Displaying info from excel files
« Reply #12 on: March 23, 2006, 09:23:36 PM »
... or this if you prefer.

Code: [Select]
Private Sub UserForm_Initialize()
  cmbMyCombo.RowSource = [set your cell range here]
  cmbMyCombo.ListIndex = [an integer starting at 0 that sets what value on your list you want showing]
End Sub

I decided to carry my variable into something else.

JJaetzold

  • Guest
Re: Displaying info from excel files
« Reply #13 on: March 23, 2006, 10:35:54 PM »
... or this if you prefer.

Code: [Select]
Private Sub UserForm_Initialize()
  cmbMyCombo.RowSource = [set your cell range here]
  cmbMyCombo.ListIndex = [an integer starting at 0 that sets what value on your list you want showing]
End Sub

I decided to carry my variable into something else.

Its funny you come up with this today.  I just decided around lunch time today to go into the vba of excel and look at the help files there.  It gave me a better understanding on how to call out the cells.  There are so many different ways of writing,  Looks like everyone is different.  I just about got it where I want it.  I'll throw some of it up here when I am more confident about its function.

Thanks for the help!!!

JJaetzold

  • Guest
Re: Displaying info from excel files
« Reply #14 on: March 24, 2006, 07:30:33 PM »
New challenge.

Now that I can populate the combobox with data,  I need to clear it. 

combobox.clear method does not work because the contents is data driven.

any alternate methods?