-
VB and an Excel Spreadsheet
I'm writing a program in VB6 that accesses an Excel spreadsheet for storing,
manipulating and printing out data. Here's what's happening:
First, consider the following code, as copied from a recorded Excel macro:
Range("A1:F56").Select
Selection.Copy
Sheets("LastDate").Select
Range("A1").Select
ActiveSheet.Paste
I recorded that macro in an effort to troubleshoot the following from the
program:
TimeSheet.Range("A1:F56").Copy
LastSheet.Select
LastSheet.Range("A1").Select
LastSheet.Range("A1").PasteSpecial
This code WORKS. . .
. . . IF I have the spreadsheet open at the same time, the code runs without
error. HOWEVER, if the spreadsheet is closed (and mind you, everything else
STILL works okay), I get the following:
Runtime Error '1004':
Select method of Range class failed.
Selecting "Debug" highlights the third line (LastSheet.Range("A1").Select)
as containing the offending code.
I'd greatly appreciate ANY help.
Dale Boyer
boyers6@home.com
dale.boyer@faa.gov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks