ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Question about worksheets in an AddIn (https://www.excelbanter.com/excel-programming/327561-question-about-worksheets-addin.html)

42N83W

Question about worksheets in an AddIn
 
Can the worksheets in an AddIn be copied to another workbook? I'd test
this, but I really don't want to convert my .xls to an .xla just yet.

Windows XP Pro
Excel 2002

Thank!

-gk-

=================================================
The creative act is not the province of remote oracles or rarefied geniuses
but a transparent process that is open to everyone.
-Greg Kot in Wilco Learning How To Die-




Jim Rech

Question about worksheets in an AddIn
 
Can the worksheets in an AddIn be copied to another workbook?

Certainly. Just think of an add-in as a workbook you can't see. Btw, to
change a workbook to an add-in and back is just a matter of flipping its
IsAddin property (in the Properties windows in the VBE). You don't have to
do a Save As.

--
Jim
"42N83W" wrote in message
...
Can the worksheets in an AddIn be copied to another workbook? I'd test
this, but I really don't want to convert my .xls to an .xla just yet.

Windows XP Pro
Excel 2002

Thank!

-gk-

=================================================
The creative act is not the province of remote oracles or rarefied
geniuses
but a transparent process that is open to everyone.
-Greg Kot in Wilco Learning How To Die-






42N83W

Question about worksheets in an AddIn
 

"Jim Rech" wrote in message
...
Can the worksheets in an AddIn be copied to another workbook?


Certainly. Just think of an add-in as a workbook you can't see. Btw, to
change a workbook to an add-in and back is just a matter of flipping its
IsAddin property (in the Properties windows in the VBE). You don't have
to do a Save As.


Follow up:

(1) How then would I copy a sheet from the AddIn to a newly created
workbook?

i.e. The user opens Excel and turns on the desired AddIn (if it is not
already on). This creates a new menu item. The user clicks on the new menu
and selects the first option. This will a) create a new workbook, and
should b) move four sheets from the AddIn to the newly created workbook.

(2) I am not seeing the IsAddin in the Properties window in the VBE. Do you
mean to change the property programatically? Where exactly is this
property?

Getting closer, but still a ways to go. Thanks!

-gk-



Bob Phillips[_6_]

Question about worksheets in an AddIn
 
Dim oldWb As Workbook
Dim newWb As Workbook

Set oldWb = ThisWorkbook
oldWb.Worksheets("Sheet1").Copy
Set newWb = ActiveWorkbook
oldWb.Worksheets("Sheet2").Copy Befo=newWb.Worksheets(1)
oldWb.Worksheets("Sheet3").Copy Befo=newWb.Worksheets(1)
oldWb.Worksheets("Sheet4").Copy Befo=newWb.Worksheets(1)

The IsAddin property is a property of the workbook , so select the
ThisWorkbook module of your workbook.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"42N83W" wrote in message
...

"Jim Rech" wrote in message
...
Can the worksheets in an AddIn be copied to another workbook?


Certainly. Just think of an add-in as a workbook you can't see. Btw,

to
change a workbook to an add-in and back is just a matter of flipping its
IsAddin property (in the Properties windows in the VBE). You don't have
to do a Save As.


Follow up:

(1) How then would I copy a sheet from the AddIn to a newly created
workbook?

i.e. The user opens Excel and turns on the desired AddIn (if it is not
already on). This creates a new menu item. The user clicks on the new

menu
and selects the first option. This will a) create a new workbook, and
should b) move four sheets from the AddIn to the newly created workbook.

(2) I am not seeing the IsAddin in the Properties window in the VBE. Do

you
mean to change the property programatically? Where exactly is this
property?

Getting closer, but still a ways to go. Thanks!

-gk-





Dave Peterson[_5_]

Question about worksheets in an AddIn
 
Option Explicit
Sub testme()

Dim wkbk As Workbook

Set wkbk = Workbooks.Add(1)

With ThisWorkbook
.IsAddin = False
.Worksheets("sheet1").Copy _
befo=wkbk.Worksheets(1)
.Worksheets("sheet2").Copy _
befo=wkbk.Worksheets(1)
.Worksheets("Sheet3").Copy _
befo=wkbk.Worksheets(1)
.IsAddin = True
End With
End Sub

You may want to consider creating a new workbook that's set up exactly the way
you want--save it as a nice template and distribute it with your addin. Then
you can just create a new workbook based on that template workbook.

Option Explicit
Sub testme()
Dim wkbk As Workbook
Set wkbk = Workbooks.Add(template:=ThisWorkbook.Path & "\" & "book2.xls")
End Sub



42N83W wrote:

"Jim Rech" wrote in message
...
Can the worksheets in an AddIn be copied to another workbook?


Certainly. Just think of an add-in as a workbook you can't see. Btw, to
change a workbook to an add-in and back is just a matter of flipping its
IsAddin property (in the Properties windows in the VBE). You don't have
to do a Save As.


Follow up:

(1) How then would I copy a sheet from the AddIn to a newly created
workbook?

i.e. The user opens Excel and turns on the desired AddIn (if it is not
already on). This creates a new menu item. The user clicks on the new menu
and selects the first option. This will a) create a new workbook, and
should b) move four sheets from the AddIn to the newly created workbook.

(2) I am not seeing the IsAddin in the Properties window in the VBE. Do you
mean to change the property programatically? Where exactly is this
property?

Getting closer, but still a ways to go. Thanks!

-gk-


--

Dave Peterson


All times are GMT +1. The time now is 10:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com