Solved

Open Excel File with VB

Posted on 2004-04-30
3
81,334 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
Comment Utility

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
Comment Utility
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
Comment Utility
Use "unload" command.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

744 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

18 Experts available now in Live!

Get 1:1 Help Now