Mike Eghtebas
asked on
Populate lstWorksheet (list box) with all worksheets present in file "C:\MyFolder\Budget.xls"
Dim FileName As String
Dim WorkshettVar As String
FileName= "C:\MyFolder\Budget.xls"
lstWorksheet.Clear
.
.<code to cycle through Worksheet names in FileName excel file to store it in variable "WorkshettVar " >
.
lstWorksheet.AddItem = WorkshettVar
This lstWorksheet (list box) is on a VB 6 form. It will be called from VB.
Thanks
Dim WorkshettVar As String
FileName= "C:\MyFolder\Budget.xls"
lstWorksheet.Clear
.
.<code to cycle through Worksheet names in FileName excel file to store it in variable "WorkshettVar " >
.
lstWorksheet.AddItem = WorkshettVar
This lstWorksheet (list box) is on a VB 6 form. It will be called from VB.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dim xlApp As New Excel.Application
Dim xlWkBk As Excel.Workbook
Dim xlWkSht As Excel.Worksheet
Set xlWkBk = xlApp.Workbooks.Open("C:\M
Set xlWkSht = xlWkBk.Worksheets("Sheet1"
For Each ws In ActiveWorkbook.Worksheets
MsgBox ws.Name
Next ws
Set xlWkSht = Nothing
xlWkBk.Close
Set xlWkBk = Nothing
xlApp.Quit
Set xlApp = Nothing
Mike