LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default script help!

i'm trying to modify this script:


Private Sub UserForm_Initialize()

Dim FileList(), i As Long, x, n As Long, fName As String

FilePath = "F:\Sec\History\" 'change to suit

fName = Dir(FilePath & "*.xls")

i = 1

Do While fName < ""

ReDim Preserve FileList(1 To i)

FileList(i) = fName

i = i + 1

fName = Dir()

Loop

ReDim Preserve FileList(1 To i - 1)

With Me.ListBox1

.Clear

.List = FileList

End With

End Sub


What i'm trying to do is, lets say i'm working on sheet "MARCH" and I want
to see what other workbooks in directory F:\Sec\History\ contain the
worksheet "MARCH". I want the listbox to show the workbooks that do contain
the worksheet and ignore the other workbooks that do not . I have a command
button that opens up the selected workbook:


Private Sub CommandButton1_Click()

Dim i As Long, wb As Workbook

With Me.ListBox1

For i = 0 To .ListCount - 1

If .Selected(i) = True Then

Set wb = Workbooks.Open(FilePath & .List(i), UpdateLinks:=0)

wb.Activate

Exit For

End If

Next

End With

End Sub



Is it possible I can get it work work this way?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with script Please Les Stout[_2_] Excel Programming 2 January 15th 08 06:49 PM
VBA, VB Script and VB clara Excel Programming 1 January 14th 08 03:10 PM
help with the VB script Igneshwara reddy[_2_] Excel Worksheet Functions 4 March 6th 07 08:54 PM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM
what is a vb script george Excel Programming 1 July 16th 03 09:56 AM


All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"