creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
Go Back  Xtreme Visual Basic Talk > > > creating VBA in XL from VB.net - combobox & etc


Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2012, 12:45 PM
kcimos kcimos is offline
Newcomer
 
Join Date: Oct 2012
Posts: 1
Default creating VBA in XL from VB.net - combobox & etc


I'm trying to add various functionality to XL files that will be created by my VB.NET routine. Working for me currently is the addition of a CHANGE event procedure for each sheet that gets created. Based on target cell's column certain actions will take place. Currently this involves checking for valid data & changeing the cell's style. For a couple of columns I need to have the following functionality (or similar):

upon the first change event in one of the appropriate columns, another XL file will be opened & the contents of column A will be read into a COMBOBOX. This combobox will than be displayed near the target cell, the user will select an available item & that will be assigned to a variable. I will need a workbook global variable to remember that this has happened.

How do I create this variable?

It also seems to me that this combobox object should also be created in the workbook, instead of each worksheet & then this one object be activated by the various worksheets' event procedures? How would I go about setting that up.

This all needs to be done through my VB.NET routine (creating the required VBA code in the XL files). When this routine is finished & run it will create approx. 100 XL files each with approx 2 to 10 sheets. I do not want to end up in a situation where I need to go back & edit the VBA code in 500 workseets.

is this how I would do that (to start):

Code:
 iShtNo = XL.WorksheetObject.Index

        XL.XlApp.EnableEvents = True

        XL.VbProjectObject = XL.WorkbookObject.VBProject
        XL.ComponantObject = XL.VbProjectObject.VBComponents.Add(Microsoft.Vbe.Interop.vbext_ComponentType.vbext_ct_StdModule)
       
        XL.ComponantObject.Name = "AddComboBoxFromAnotherXlFile" 
        XL.CodeModuleObject = XL.ComponantObject.CodeModule


        With XL.CodeModuleObject
if so, how about creating the combobox, I have found this:

Code:
Dim xlcombobox As Excel.OLEObject

xlcombobox = XL.WorksheetObject.OLEObjects.Add(ClassType:="Forms.combobox.1", Link:=False, DisplayAsIcon:=False, Left:=30, Top:=20, Width:=72, Height:=24)
xlcombobox.Name = "PlotStyles"
but that is for a worksheet & my excel.OLEobject doesn't have any "ADD" methods either, so how do I add the combobox to the workbook?

Last edited by Cerian Knight; 10-03-2012 at 09:12 AM. Reason: Decreased code indent for display purposes
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
 
creating VBA in XL from VB.net - combobox & etc
creating VBA in XL from VB.net - combobox & etc
 
-->