?
Solved

Open Excel File with VB

Posted on 2004-04-30
3
Medium Priority
?
81,372 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
[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 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

718 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