Solved

Open Excel File with VB

Posted on 2004-04-30
3
81,337 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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now