473,626 Members | 3,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB list box how to obtain text in selected rows ?

Hi

Here's how i fill the list :

Private Sub CommandButton1_ Click()

Dim sFilename As Variant

sFilename = Application.Get OpenFilename("E xcel files (*.xls; *.csv),
*.xls; *.csv", 0, "Wybierz pliki", 0, True)

For Y = 1 To UBound(sFilenam e)
ListBox1.AddIte m (sFilename(Y))
Next

End Sub

When files are selected i want to open them using Workbooks.Open
(sFilename(Y)) - but in loop that method doesnt work - why ? And how
to obtain text in selected rows ? Supose i have
Private Sub CommandButton2_ Click() in which i want to open selected
files - how to do it ?
thx for all sugestions

Oct 16 '07 #1
1 1509
Are you sure you are posting in the right group?

????Dim sFilename as Variant?????
Sounds like VB6 to me, in which case look at the ListBox.Selecte d(index)
property.

If .Net, look at ListBox.Selecte dItems property.

--
Terry
"wo****@gmail.c om" wrote:
Hi

Here's how i fill the list :

Private Sub CommandButton1_ Click()

Dim sFilename As Variant

sFilename = Application.Get OpenFilename("E xcel files (*.xls; *.csv),
*.xls; *.csv", 0, "Wybierz pliki", 0, True)

For Y = 1 To UBound(sFilenam e)
ListBox1.AddIte m (sFilename(Y))
Next

End Sub

When files are selected i want to open them using Workbooks.Open
(sFilename(Y)) - but in loop that method doesnt work - why ? And how
to obtain text in selected rows ? Supose i have
Private Sub CommandButton2_ Click() in which i want to open selected
files - how to do it ?
thx for all sugestions

Oct 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2452
by: gooderthanyou | last post by:
I have a textfield and you of course you can select text... When they hit the bold button I want it to obtain the selected text and bold it, the hard part is trying to figure out if javascript can even OBTAIN selected text?!?! I can do this in java if I have to, I know java better than javascript, it seems as that is the only way to do it from looking online. <-- me javascript beginner
4
2176
by: John Wildes | last post by:
Hello I have a small program that I've created to generate accounting statements out of our policy managment system. The first part of the process is selecting the customer to create the statement for. In this process the application queries the database, returns a dataset of just customer names, and their customer code that is displayed in a list. This results in something like 200 names.
2
1950
by: Steph | last post by:
I have created a multiselect list box control (lbx_comorb) that is populated from a datatable (dt_ptAdmission). The list box populates now problem at all. However the issue is when I load the webform, when there is already admission data. I need the populated list box (lbx_comorb) to show the items that were previously selected for this admission. The selected comorb data is stored in another datatable (dt_ptComorb). If anyone can...
0
3231
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another way... here is my code on how I did it to help anyone starting out get an idea of how to use virtual mode in ..NET 2.0 Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared
0
1227
by: dbuchanan | last post by:
Hello, The actions pane locks up after selecting a listbox. I have tried all kinds of things and have narrowed it down to this. If I click in the listbox the action pane locks up. Neither a combo box nor a button will work after clicking in the list box. There are no events associated with the list box. This is a mystery to me. What could be causing this behavior? What could be the remedy?
6
1874
by: hardik | last post by:
hi friends i am very new to java script.if anyone can help me out then i will be thankful. i am using php and mysql in my learning project and i have two list boxes,now whenever user presses first listbox i mean user selects listbox then approprieate records should be come in second listbox.can i do it with javascript? i.e if user selects list item 'class bca' then all the records related to 'class bca' should come to
7
4507
by: ljungers | last post by:
Have Form-1 with 3 text boxes and 1 command button. With any of the 3 boxes filled out and button is clicked, a Macro is performed that Opens a Query that has a WHERE clause that uses the 3 test boxes of data from form-1. 1) How do I cause the SQL command window not to show for that SQL command? The query results is placed in a ListBox on Form-2 and desired rows in the list box are selected/clicked, followed by a click on a button that...
1
1567
by: raam | last post by:
hi I have a list box with some country names from database. when i click search button the "country" list selecteditem should be selected. but it is not. here is my code where iam using a stored procedure which is outputting 3 tables simultaneously. the list box of country is 3rd table that is table if (objDataSet.Tables.Rows.Count > 0) {
0
8266
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5574
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.