Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Open Excel File with VB

Posted on 2004-04-30
3
Medium Priority
?
81,380 Views
Last Modified: 2013-12-25
I am a student of VB.  I am trying to figure out how to open an Excel workbook by clicking on a button on my VB form.  I keep getting a message that the method is unsupported and the starred line is highlighted when I debug.  Can someone please tell me what I'm doing wrong?

    Dim xlApp As Excel.Application
    Dim xlWB1 As Excel.Workbook
   
    Set xlApp = New Excel.Application
    *Set xlWB1 = xlApp.OpenWorkbook("e:\paige\vb program\delinquent.xls")
    xlWB1.Close
    Set xlWB1 = Nothing
   
    xlApp.Quit
    Set xlApp = Nothing
0
Comment
Question by:fp4645
3 Comments
 
LVL 24

Accepted Solution

by:
R_Rajesh earned 200 total points
ID: 10963800

use xlApp.Workboks.Open

Dim xlApp As Excel.Application
Dim xlWB1 As Excel.Workbook
Set xlApp = New Excel.Application
xlApp.Visible = True
Set xlWB1 = xlApp.Workbooks.Open("e:\paige\vb program\delinquent.xls")
xlWB1.Close
Set xlWB1 = Nothing
xlApp.Quit
Set xlApp = Nothing

Rajesh
0
 

Expert Comment

by:aminvb
ID: 11816783
i want to shut down windows by vb code .(in every windows)
i can`t write english beter .
please help me .
thanks
aminvb
0
 

Expert Comment

by:solar331
ID: 21359307
Use "unload" command.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

963 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