Solved

How do I inject VBA into Excel?

Posted on 2011-09-06
12
461 Views
Last Modified: 2012-05-12
I need to use existing code that populates a combo box in Excel, but am not sure where or how to add the code.

Can anyone tell me?

Thanks.
0
Comment
Question by:newbieweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
12 Comments
 
LVL 48

Accepted Solution

by:
Martin Liss earned 200 total points
ID: 36491863
Click the little 'Visual basic editor' button that you'll find to the right of the 'Securiy…' menu item.
0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 36491869
After that it's pretty much like VB6 if you're familiar with it.
0
 

Author Comment

by:newbieweb
ID: 36491902
Sorry, I forgot to say Excel 2007. And what tab do I select?
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:newbieweb
ID: 36491912
Is it the View Code button?
0
 

Author Comment

by:newbieweb
ID: 36491934
If so, please explain the various Microsoft Excel Object...
0
 
LVL 81

Assisted Solution

by:byundt
byundt earned 150 total points
ID: 36491936
If you are using a Forms toolbar combobox, the code goes in a regular module. Use the Insert...Module menu item in the VBA Editor to create a regular module sheet if you don't have one.

If you are using an Active-X combobox, the code goes in the code pane for the worksheet. Right-click the sheet tab and choose View Code to expose that code pane.
0
 
LVL 24

Assisted Solution

by:StephenJR
StephenJR earned 150 total points
ID: 36491949
For an ActiveX control, yes. Is it in the sheet or on a form?
0
 
LVL 48

Expert Comment

by:Martin Liss
ID: 36491962
0
 

Author Comment

by:newbieweb
ID: 36491976
I intend to use the VBA in this link:

http://datapigtechnologies.com/blog/index.php/recordset-tricks-in-excel-1-filling-a-combobox-with-unique-values/

to fill the combo from another Excel file. Then I plan to edit it to also read the data from a database.

I am not sure where to put that data.
0
 

Author Comment

by:newbieweb
ID: 36492059
The link talks about using an Active X control.

> Is it in the sheet or on a form?

It's on the sheet, not a form.

Those tiff's do not look anythin like my Excel, which is 2007. Am I missing something?
0
 

Author Comment

by:newbieweb
ID: 36492075
BUT, I do not want this any more complicated than necessary. I just want to move the contents of a combo box to outside of the Excel, first to another Excel, then to a database. If you have an easier way, please be my guest.
0
 

Author Closing Comment

by:newbieweb
ID: 36496421
Thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question