how to get ws from excel into vb ?

please tell me how to create a program that can give the user to get worksheet from different file in excel and print
the worksheet by the page no. ie 1 , 2 3 and ..........

for your information, i having so many excel file. and i want to get a worksheet from different file in excel and now i want it to be print and after i get all the worksheet into the vb program, it will print the worksheet in the sequece page no. and i know i can do it even not using vb. but i hate to copy so many file and got to open so many file just to print a different ws form diffenrent file.
so please give me the way and step by step code.

thanks.
JOHNHOAsked:
Who is Participating?
 
InteqamConnect With a Mentor Commented:
Set Database = DBEngine.Workspaces(0).OpenDatabase("Workbook              
 Name.xls", Connect:="Excel 5.0;")                                              
     Set Recordset = Database.OpenRecordset("Worksheet Name")                  
                                                                               
     As far as I know, you can only open snapshots, which means you won't      

 be able to write to the worksheet.  Connect should be "Excel 5.0;" for        
 Excel 5.0 & 7.0                                                                
0
 
JOHNHOAuthor Commented:
yes , i wont write the data inside it.
but the answer that u tell me is to general. you got to tell me what i got to put in my form, do i need to put data control ? and btw is the  workbook name is the excel file name ? if it is, you r wrong because i has so many file and i canot put default file into it. sorry if i wrong.
                                  and also if is worksheet name is a default name for excel file ? or i just type " worksheet name" ? and last one do i need to put ole into the form ?

please give me step by step .
thanks in advance

       
0
 
InteqamCommented:
you will use dao , not datacontrol

change worksheet name with the sheet you want to open

0
 
JOHNHOAuthor Commented:
where can i fin d the dao ?


0
All Courses

From novice to tech pro — start learning today.