Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to get ws from excel into vb ?

Posted on 1999-06-29
5
Medium Priority
?
229 Views
Last Modified: 2012-05-04
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.
0
Comment
Question by:JOHNHO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
Inteqam earned 200 total points
ID: 1520667
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
 

Author Comment

by:JOHNHO
ID: 1520668
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
 
LVL 7

Expert Comment

by:Inteqam
ID: 1520669
you will use dao , not datacontrol

change worksheet name with the sheet you want to open

0
 

Author Comment

by:JOHNHO
ID: 1520670
where can i fin d the dao ?


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question