Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Templates in Add-in

Hello,

I am learning VBA and I just created several templates/forms (sheets) that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be able to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Templates in Add-in

thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms (sheets) that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be able to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Templates in Add-in

Tom,

The command does not work (doesn't do anything, not even an error) but maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not opened but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from) test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms (sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Templates in Add-in

Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error) but maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not opened but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from) test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms (sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Templates in Add-in

Sorry but this does not work either. The sheet I want to copy is in the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error) but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms (sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Templates in Add-in

Have you made the sheet in the addin hidden (which is not necessary since the
sheets in an addin are not visible by virtue of being an addin? That being
the case...

Sheet1.Visible = xlSheetVisible
Sheet1.Copy

--
HTH...

Jim Thomlinson


"Eric" wrote:

Sorry but this does not work either. The sheet I want to copy is in the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error) but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms (sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Templates in Add-in

Still does not work, and no, the sheet is visible.

How does the command know that the sheet is coming from the Add-in?

Here's what I have so far:

With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Test template"
.OnAction = Sheets("Test1").Copy
End With

Thank you.


Eric

"Jim Thomlinson" wrote in message
...
Have you made the sheet in the addin hidden (which is not necessary since
the
sheets in an addin are not visible by virtue of being an addin? That being
the case...

Sheet1.Visible = xlSheetVisible
Sheet1.Copy

--
HTH...

Jim Thomlinson


"Eric" wrote:

Sorry but this does not work either. The sheet I want to copy is in the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in
message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error) but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not
opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms
(sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Templates in Add-in

Eric

Try this............

Workbooks("myaddin.xla").Sheets("Sheet1").Copy


Gord Dibben MS Excel MVP

On Wed, 21 Feb 2007 16:58:40 -0500, "Eric" wrote:

Sorry but this does not work either. The sheet I want to copy is in the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error) but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms (sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Templates in Add-in

Your OnAction must be a text string and not an executable action... something
like this...

With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Test template"
.OnAction = "Module1.CopySheet1"
End With

'In module 1 place this code...

public sub CopySheet1()
sheet1.copy
end sub
--
HTH...

Jim Thomlinson


"Eric" wrote:

Still does not work, and no, the sheet is visible.

How does the command know that the sheet is coming from the Add-in?

Here's what I have so far:

With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Test template"
.OnAction = Sheets("Test1").Copy
End With

Thank you.


Eric

"Jim Thomlinson" wrote in message
...
Have you made the sheet in the addin hidden (which is not necessary since
the
sheets in an addin are not visible by virtue of being an addin? That being
the case...

Sheet1.Visible = xlSheetVisible
Sheet1.Copy

--
HTH...

Jim Thomlinson


"Eric" wrote:

Sorry but this does not work either. The sheet I want to copy is in the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in
message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error) but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not
opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms
(sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.









  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Templates in Add-in

Hi Jim,

It works!! My question now is why? How does it know that sheet1 is the one
in my Add-in and not the one in the current workbook for instance?

Thank you.

Eric



"Jim Thomlinson" wrote in message
...
Your OnAction must be a text string and not an executable action...

something
like this...

With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Test template"
.OnAction = "Module1.CopySheet1"
End With

'In module 1 place this code...

public sub CopySheet1()
sheet1.copy
end sub
--
HTH...

Jim Thomlinson


"Eric" wrote:

Still does not work, and no, the sheet is visible.

How does the command know that the sheet is coming from the Add-in?

Here's what I have so far:

With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Test template"
.OnAction = Sheets("Test1").Copy
End With

Thank you.


Eric

"Jim Thomlinson" wrote in

message
...
Have you made the sheet in the addin hidden (which is not necessary

since
the
sheets in an addin are not visible by virtue of being an addin? That

being
the case...

Sheet1.Visible = xlSheetVisible
Sheet1.Copy

--
HTH...

Jim Thomlinson


"Eric" wrote:

Sorry but this does not work either. The sheet I want to copy is in

the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in
message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error)

but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not
opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to

create
automatically a new workbook with a new sheet based on (copied

from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in

message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms
(sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like

to be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.













  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Templates in Add-in

That's your responsibility in writing the add-in. Make sure the
reference is fully qualified. For example:

Public Sub CopySheet1()
ThisWorkbook.Sheets("Test1").Copy
'...
End Sub


In article ,
"Eric" wrote:

It works!! My question now is why? How does it know that sheet1 is the one
in my Add-in and not the one in the current workbook for instance?

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Templates in Add-in

OK, thank you.


"JE McGimpsey" wrote in message
...
That's your responsibility in writing the add-in. Make sure the
reference is fully qualified. For example:

Public Sub CopySheet1()
ThisWorkbook.Sheets("Test1").Copy
'...
End Sub


In article ,
"Eric" wrote:

It works!! My question now is why? How does it know that sheet1 is the

one
in my Add-in and not the one in the current workbook for instance?



  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Templates in Add-in

Thank you.


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Eric

Try this............

Workbooks("myaddin.xla").Sheets("Sheet1").Copy


Gord Dibben MS Excel MVP

On Wed, 21 Feb 2007 16:58:40 -0500, "Eric" wrote:

Sorry but this does not work either. The sheet I want to copy is in the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in

message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error) but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not

opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms

(sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.







  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Templates in Add-in

thats is why I told you

thisworkbook.Worksheets(1)

You didn't say what you wanted to do so I didn't elaborate. But to refer to
the elements of the Addin when using code contained in the addin, use the
qualifier thisworkbook.

--
Regards,
Tom Ogilvy


"Eric" wrote:

Still does not work, and no, the sheet is visible.

How does the command know that the sheet is coming from the Add-in?

Here's what I have so far:

With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Test template"
.OnAction = Sheets("Test1").Copy
End With

Thank you.


Eric

"Jim Thomlinson" wrote in message
...
Have you made the sheet in the addin hidden (which is not necessary since
the
sheets in an addin are not visible by virtue of being an addin? That being
the case...

Sheet1.Visible = xlSheetVisible
Sheet1.Copy

--
HTH...

Jim Thomlinson


"Eric" wrote:

Sorry but this does not work either. The sheet I want to copy is in the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in
message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error) but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not
opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to create
automatically a new workbook with a new sheet based on (copied from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms
(sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.









  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Templates in Add-in

Makes sense now, thank you.

Eric


"Tom Ogilvy" wrote in message
...
thats is why I told you

thisworkbook.Worksheets(1)

You didn't say what you wanted to do so I didn't elaborate. But to refer
to
the elements of the Addin when using code contained in the addin, use the
qualifier thisworkbook.

--
Regards,
Tom Ogilvy


"Eric" wrote:

Still does not work, and no, the sheet is visible.

How does the command know that the sheet is coming from the Add-in?

Here's what I have so far:

With cbMenu.Controls.Add(msoControlButton, 1, , , True)
.Caption = "Test template"
.OnAction = Sheets("Test1").Copy
End With

Thank you.


Eric

"Jim Thomlinson" wrote in
message
...
Have you made the sheet in the addin hidden (which is not necessary
since
the
sheets in an addin are not visible by virtue of being an addin? That
being
the case...

Sheet1.Visible = xlSheetVisible
Sheet1.Copy

--
HTH...

Jim Thomlinson


"Eric" wrote:

Sorry but this does not work either. The sheet I want to copy is in
the
Add-in but is not apparent..

Thank you.

Eric



"Jim Thomlinson" wrote in
message
...
Sheet1.Copy
or
Sheets("Sheet1").Copy
--
HTH...

Jim Thomlinson


"Eric" wrote:

Tom,

The command does not work (doesn't do anything, not even an error)
but
maybe
I wasn't clear enough.

My Add-in had 2 sheets called test1 and test2. The Add-in is not
opened
but
just "loaded" through Tools / Add-ins ....
Once loaded the Add-in creates a menu. I'd like to be able to
create
automatically a new workbook with a new sheet based on (copied
from)
test1
or test2 from the loaded Add-in.

Thank you again.

Eric

"Tom Ogilvy" wrote in message
...
thisworkbook.Worksheets(1).Range("A1").Value

--
Regards,
Tom Ogilvy



"Eric" wrote:

Hello,

I am learning VBA and I just created several templates/forms
(sheets)
that I
saved into an Add-in.
The Add-in creates automatically a menu item and I would like to
be
able
to
call the templates (sheets) saved in the Add-in from this menu.

How can I do that? What would be the command to execute?

Thank you.

Eric


.











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
saved templates opening as templates 4n6DNA Excel Discussion (Misc queries) 2 August 31st 09 09:30 PM
Templates Mary Excel Discussion (Misc queries) 0 February 12th 09 10:46 PM
templates MaggsCam New Users to Excel 3 February 22nd 07 10:15 AM
Excel is opening templates as templates instead of as worksheets Desram Setting up and Configuration of Excel 1 January 19th 06 09:38 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"