If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.
Use the wizard to do ya shit..read up on tutorials..thats what I did..I think you need to make a table to gather ya data in combo box..this is old skewl stuff which I can't remember :?
Here's how you grab data from excel using wscript. Stolen from msdn.microsoft.com, saw it today while looking for something else
' -------------------------------------------------------------
' Start the Excel Worksheet reading
' Bind to an Excel worksheet object
Set objXL = WScript.CreateObject("EXCEL.application")
' Make it visible
'objXL.Visible = True
' Open the desired workbook containing the users list
objXL.workbooks.open strExcelSheetPath
' Activate the named page "Export"
objXL.sheets("Export").Activate
' Put the cursor on the A2 cell
objXL.ActiveSheet.range("A2").Activate
Once the range has been returned, the script can iterate through the row in the range and pull the user information from each cell in the row:
' Until we run out of rows
Do While objXL.activecell.Value <> ""
' -----------------------------------------------------
' Parameters for the user's mailbox creation under LDAP: namespace
strFirstName = objXL.activecell.offset(0, 0).Value
strLastName = objXL.activecell.offset(0, 1).Value
'... More extraction of info here see the script for exact details
in the above loop is where you'd stick the shit into a combo box.
for an access db you'd use ADO. Look it up.. pretty straight forward
lots of examples in the vb helpfiles, and on the net.
if you can't be bothered, a good resource for stealing code is www.pscode.com
do u know how to put the vba form into the main window of excel ?
so when u open a spreadsheat u get the form ?
possible ?
yeah..
from excel:
open the workbook that u wanna work on..
go tools->macro->visual basic editor
look in the project pane in the left.
Assuming you've already created the form it should show up under a forms folder. otherwise right click on the project pane and click insert -> userform.
Anyway, double click on the 'This workbook' icon thingo in the left hand project pane so it brings up the code window.
Above the code window there should be 2 drop down boxes.
On the left one select 'workbook', on the right one select 'open'.
That should automatically create a sub that looks like this
Private Sub Workbook_Open()
End Sub
then you just gotta add the form show line
eg
Private Sub Workbook_Open()
UserForm1.Show
End Sub
where userform1 = the name of your form
Assuming macro security level is medium or low and you enable macros, that should show up when you open the workbook.
Comment