PDA

View Full Version : Sleeper: Copy worksheet



v_gyku
09-16-2005, 03:42 AM
I want to add all the worsheets of selected workbook to a listbox.but without opening a workbook.

i have done it in the following way




Set Wkb = Workbooks.Open(fileName:=mypath)
For Each ws In Wkb.Worksheets
SheetList.Add ws.name & ".xls"
Next
n = SheetList.Count
For i = 1 To n
UserControl.List1.AddItem SheetList(i)
Next i



but here excel opens that workbook.still thios is ok.
but when a wbook having password is opened it asks mw for password.I dont want that.
I want to send a sheet directly without opening it.

Also i am saying activesheet.copy -- if i am not opening a workbook how will i copy a worksheet which i have selected from the listbox.