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