• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copying worksheets with Add-ins functionality intact

excelrok

New Member
I'm trying to copy a worksheet from a Template (see attached file) to a new file, but when I do, the new file with the copied template no longer has the Add-ins function at the top. is there a way I can copy the worksheet with everything intact? thanks in advance for the help.
 

Attachments

Welcome to the forum!

The code for the add-in is stored with the workbook, not a sheet. You would need to save the whole workbook as something else. Additionally, I would suggest using the file extension .xltm (macro enabled template). That would protect the actual Template from getting over-written, while allowing you to just open the file, and have it auto-generate a new file for you.
 
Welcome to the forum!

The code for the add-in is stored with the workbook, not a sheet. You would need to save the whole workbook as something else. Additionally, I would suggest using the file extension .xltm (macro enabled template). That would protect the actual Template from getting over-written, while allowing you to just open the file, and have it auto-generate a new file for you.

Hi Luke, my situation is a bit more complicated than that. I have another workbook (let's call it File B) with a bunch of worksheets in it, and I need to add this template with the add-in function to it. I had the option of either copying all the worksheets from file B to this template file or find a way to copy this template into this file B. Do you happen to know a way to copy the workbook from the template file to this file B so that it will retain this add-ins functionality?
 
Do you need the worksheet from the template, or more just the SAP toolbar? If the latter, I'd save your template as an xla (xl add-in), and then you can activate the add-in under Excel options.
upload_2014-7-23_9-29-8.png
Then, your add-in would be available from any workbook that you have open. I have a couple of add-ins that I use this for.

Or, another option is to put all the code from the template into your Personal workbook. The Personal workbook gets loaded everytime and runs in the background, and can hold lots of your favorite code.

In direct answer, there is no easy way to move the coding from one workbook into another. You would need to go into the VBE and move it from there. Or, move fileB's worksheets into the template.
 
Do you need the worksheet from the template, or more just the SAP toolbar? If the latter, I'd save your template as an xla (xl add-in), and then you can activate the add-in under Excel options.
View attachment 8718
Then, your add-in would be available from any workbook that you have open. I have a couple of add-ins that I use this for.

Or, another option is to put all the code from the template into your Personal workbook. The Personal workbook gets loaded everytime and runs in the background, and can hold lots of your favorite code.

In direct answer, there is no easy way to move the coding from one workbook into another. You would need to go into the VBE and move it from there. Or, move fileB's worksheets into the template.

The template works in conjunction with the SAP add-in to load the data into SAP. I just attempted your first method and I didn't see any add-in toolbar after loading the XLA file which I had saved from the template.
 
Go to the ThisWorkbook module. Just noticed that you're using the Activate/Deactivate events. Let's change these to Open/Close (since as an add-in, the workbook isn't getting activated.
Code:
Private Sub Workbook_Open()
    'When the spreadsheet is active, we want to load the SAP menu if it doesn't already exist
    AddSAPMenu
    ActiveWorkbook.ActiveSheet.Cells(2, 1).Value = True
End Sub

Private Sub Workbook_Close()
    'When the spreadsheet is not active, we want to unload the SAP menu
    RemoveSAPMenu
End Sub
 
Back
Top