473,395 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Open a file with file name from listbox

click on name, and open with windows explorer.

I tried using shell
(Code)
Shell "explorer.exe " & sPath & lstYellow.Value, vbNormalFocus
(/code)

sPath is a variable set earlier and is ok, but I need to get the file name out of lstYellow, and value is not a good property. I have tried selected, listindes and others, but I think I just need some help in formatting, as the code is not finding the file at all.

I had help in etting this up,
I am not even sure how the shell line is supposed to look for this.
but something like this
Shell "explorer.ext" & "c:\App\Yellow|" & "012345.bmp", vbNormalFocus
(I am thinking the spacing must be very important, and I am sure the file is there) The file name does not show quotes in the list box.
Any help will be appreciated.
Thanks
Ken
Feb 8 '08 #1
3 4576
ADezii
8,834 Expert 8TB
click on name, and open with windows explorer.

I tried using shell
(Code)
Shell "explorer.exe " & sPath & lstYellow.Value, vbNormalFocus
(/code)

sPath is a variable set earlier and is ok, but I need to get the file name out of lstYellow, and value is not a good property. I have tried selected, listindes and others, but I think I just need some help in formatting, as the code is not finding the file at all.

I had help in etting this up,
I am not even sure how the shell line is supposed to look for this.
but something like this
Shell "explorer.ext" & "c:\App\Yellow|" & "012345.bmp", vbNormalFocus
(I am thinking the spacing must be very important, and I am sure the file is there) The file name does not show quotes in the list box.
Any help will be appreciated.
Thanks
Ken
The Shell() Function is used primarily to Run an executable File, but strangely enough can be used to Open other File Extensions when used in the manner in which you indicate. The code snippet below should point you in the right direction:
Expand|Select|Wrap|Line Numbers
  1. Dim retVal As Variant, sPath As String
  2.  
  3. sPath = "C:\App\Yellow\"
  4.  
  5. 'Where Me![lstYellow] = 012345.bmp
  6. retVal = Shell("explorer.exe " & sPath & Me![lstYellow], vbNormalFocus)
Feb 8 '08 #2
ADzeii,
Thank you very much. I appreciate you taking the time .
Ken
Feb 8 '08 #3
ADezii
8,834 Expert 8TB
ADzeii,
Thank you very much. I appreciate you taking the time .
Ken
You are quite welcome.
Feb 8 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Martin | last post by:
Again drawing on the groups experience:- 1. For general file opening and file saving, using VB6, are there any issues with using the FileOpen and FileSave Common Dialog Boxes? 2. Is using the...
4
by: Andras Gilicz | last post by:
Hi VB fans I'm working on a relatively large project in VB6 with about a dozen forms, including graphs, labels, text boxes, etc. The software itself is actually a flow simulator with more or...
5
by: Paolo | last post by:
Friends, I have created a form with a list box that shows all my Word files. I have then added the following code (found on comp.databases newsgroup) to the Open event of my form and it works...
2
by: Light | last post by:
Hi I am a relatively inexperienced and I need help in this, what seems to be a simple task I am trying to read from a text file which contains a list of peoples names in the format 'Surname...
13
by: Daniel Walzenbach | last post by:
Hi, Imagine the following situation: I have an asp.net application which allows uploading files to a SQL Server 2000 database (Files are stored as type "images"). As a next step I would like to...
3
by: colleen1980 | last post by:
There are two continuous subforms in main form. All are linked with ticketNum. When user comes to subform2. I need that Field3 of subform2 will automatically filled with field2 (field2 is a...
2
by: rn5a | last post by:
Using the FileSystemInfo class, I am retrieving all the directories & files existing in a particular directory on the server & listing them in a ListBox. If an item in the ListBox happens to be a...
4
by: nottarealaddress | last post by:
I'm trying to get my feet wet in VB2005 (our new standard at work after officially stopping new development in VB6 about a month ago). I'm working with a simple sql 2005 table of 50 entries, one...
2
by: Plumebee | last post by:
Hi, I am very new to programming and have just started to use Visual Basic 2005 Express Edition. I am trying to read from a text file to draw a rectangles and lines. However to begin I'm trying to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.