View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default How do you import sheets into an Excel XLA Add-In?

Hi smileclick -

Joel's solutions work properly and open the addin file, but I'm interpreting
your original post differently.

If I understand your problem correctly, I don't think that it's possible to
import new worksheets into an addin (.xla). The action of making an addin
from a normal workbook converts the workbook into a static XLA file for the
primary purpose of making its VB code internally available to other workbooks
(without reference to the workbook containing the code). I believe the only
way to modify an addin XLA file is to modify the original workbook file that
was used to create it and save the modified workbook as a new addin XLA file.
Making an addin is like forging a horseshoe; once it's quenched and
tempered, it can't be changed.

Please correct me if you (or others) have discovered otherwise or my
interpretation is missing the mark.
--
Jay


"smileclick" wrote:

I'm trying to import worksheets from a spreadsheet file into an the running
XLA Add-In (the XLA holding the code for importing the spreadsheets).

I tried using:
Sheets(Array("Sheet1","Sheet2")).Copy After:=ThisWorkbook.Sheets(1)

But got a "Run-time error '1004': Copy Method of Worksheet Class failed" error

I tried using:
Sheets.Add Type:=Source_File_Name, befo=ThisWorkbook.Sheets(1)
But it will only add the sheets to the Active Workbook, not the XLA Workbook
(if there is no open workbook I get a "Method 'Sheets' of object '_Global'
failed" error).