![]() |
|
#1
|
|||
|
|||
![]() Quote:
Setting Workbook.IsAddin to true and saving it as an addin file makes it behave how I wanted, hiding the workbook from view. I do have excel 2010 now, the office updated it since I last posted! I will try and change my profile. I just had a look at RibbonX, that sounds like a right pain! I will have to investigate that a little further. My macro doesn't work because it uses "ActiveSheet" which is the macro sheet, not the sheet the user is on when they press the copy/paste buttons. I resolved it using "ActiveWorkbook.ActiveSheet": Code:
Dim copiedCells As Range Sub CopyFormulae() Set copiedCells = Application.Selection End Sub Sub PasteFormulae() Dim s As Range Set s = Selection 'ActiveWorkbook.ActiveSheet For columnPaste = 1 To copiedCells.Columns.Count For rowPaste = 1 To copiedCells.Rows.Count Dim c As Range Set c = ActiveWorkbook.ActiveSheet.Cells(s.Row + rowPaste - 1, s.Column + columnPaste - 1) c.Formula = copiedCells.Cells(rowPaste, columnPaste).Formula Next rowPaste Next columnPaste End Sub Sub ClearCopiedData() Set copiedCells = Nothing End Sub Code:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> <ribbon> <tabs> <tab idMso="TabHome"> <group id="GroupFormulae" label="Formulae" insertAfterMso="GroupClipboard" > <button id="ButtonFormulaeCopy" label="Copy" size="Small" image="HappyFace" onAction="ButtonFormulaeCopyPressed"/> <button id="ButtonFormulaePaste" label="Paste" size="Small" image="HappyFace" onAction="ButtonFormulaePastePressed"/> <button id="ButtonFormulaeClear" label="Clear" size="Small" image="HappyFace" onAction="ButtonFormulaeClearPressed"/> </group> </tab> </tabs> </ribbon> </customUI> Code:
Sub Workbook_AddinInstall() End Sub Sub Workbook_AddinUninstall() End Sub Public Sub ButtonFormulaeCopyPressed(control As IRibbonControl) MsgBox "test1" End Sub Public Sub ButtonFormulaePastePressed(control As IRibbonControl) MsgBox "test2" End Sub Last edited by hanvyj; 12-14-2012 at 04:23 AM. |
![]() |
Tags |
addin, macro |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
glnz | Word VBA | 8 | 09-07-2022 02:09 PM |
Are changes to the ribbon global? | TechEd | Word | 0 | 05-26-2011 12:23 AM |
![]() |
ryalls3857 | Word | 1 | 12-27-2010 05:45 PM |
![]() |
mkoenig | Word VBA | 1 | 01-31-2010 02:47 AM |
how to make global changes in existing doc? | hamster | Word | 0 | 03-18-2009 08:39 AM |