PC Review


Reply
Thread Tools Rate Thread

Coping Excel Worksheets To New Individual Excel spreadsheet from Access

 
 
Michael The Red
Guest
Posts: n/a
 
      10th Sep 2003
I have been developing a Access Db that should be able to
manipulate, and use, data from Excel worksheets with
multiple tabs (sheets). I am currently attempting to use
a Access form that allows the user to enter the Excel
spreadsheet's name and location. Using "GetObject", I
have been able to select a specific tab on the Excel
spreadsheet. I then make a copy of that specific tab and
save that tab as a new Excel document using the
following code :

Dim excelAppObject As Object
Dim excelAppParent As Object

Set excelAppObject = GetObject(fileLocation)
Set excelAppParent = excelAppObject.Parent

excelAppObject.Sheets(copySheet01).Select
excelAppObject.Sheets(copySheet01).Copy

excelAppParent.ActiveWorkbook.SaveAs FileName:= _
fileCopyLoc & "\Sheet01.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

That portion works fine and a new Excel document is
created, however the Access Db should also allow the
coping of many Excel sheets (tabs) and make additional
Excel spreadsheets.

I tried to do this below to select another tab from the
same Excel spreadsheet and create another Excel document.

excelAppObject.Sheets(copySheet02).Select
excelAppObject.Sheets(copySheet02).Copy

VB give me the following error:

"Run-time error '1004':
"Selected method of Worksheet class failed"

How can I copy multiple tabs from a Excel Spreadsheet and
save them as individual Excel Spreadsheet..I am stuck!

Any feedback would be appreciated. Thanks


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Coping files from Access DB to an Excel Spreadsheet Ev Microsoft Access 6 18th Sep 2009 10:15 PM
Export From Access to Excel To Individual Worksheets =?Utf-8?B?TUxWaWNr?= Microsoft Access External Data 2 12th Oct 2007 04:36 PM
how to export ALL worksheets in an Excel spreadsheet to individual CSV files Microsoft Excel Discussion 4 14th Jan 2004 01:20 PM
Coping Excel Worksheets To New Individual Excel spreadsheet from Access Michael The Red Microsoft Access Macros 0 10th Sep 2003 07:25 AM
Coping Excel Worksheets To New Individual Excel spreadsheet from Access Michael The Red Microsoft Access 0 10th Sep 2003 07:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:03 AM.