Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Phantom person using excel file

Posted on 2003-03-04
3
Medium Priority
?
177 Views
Last Modified: 2010-04-07
I have been programming a little VB referencing the excel library. I open the file using the workbooks.open command. Then i close it with workbooks.close command. however, after running this code, whenever i try to open the "1.csv" file now, it says that it is locked for editing, by 'another user'. what's going on?


sub main()

Workbooks.Open FileName:="C:\Documents and Settings\Jason\My Documents\1.csv"

a = Range("b8")
MsgBox (a)
Workbooks.Close
end sub
0
Comment
Question by:storkuk79
3 Comments
 

Expert Comment

by:cskang
ID: 8063536
One reason is that your application crashed or you ended it in debug mode before executing the Workbooks.close  .
If that is the problem
goto
Windows Task Manager >> processes tab
find excel.exe
end process
0
 

Accepted Solution

by:
gprassad earned 600 total points
ID: 8063598
hi storkuk79

try this one...


Option Explicit
Dim xlsApp As Excel.Application

Private Sub Command1_Click()
    Set xlsApp = Excel.Application
   
    xlsApp.Visible = True
    xlsApp.workbooks.Open ("C:\1.csv")
   
    MsgBox xlsApp.Range("B8")
    xlsApp.workbooks.Close
    xlsApp.Quit

       
   
End Sub
0
 

Author Comment

by:storkuk79
ID: 8069000
thanks for help guys
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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
Course of the Month11 days, 4 hours left to enroll

571 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