In the Dec 2005 Ozgrid newsletter there is some sample code to disable commandbar controls. The example code crashes when it trys to disable the copy button on the Clipboard menu (Excel 2000) and ONLY the clip board menu. All others are fine.
'Disable all Copy menus
For Each oCtrl In Application.CommandBars.FindControls(ID:=19)
oCtrl.Enabled = False
I Have a spreadsheet in which data is spreading into column A-Z. I would like to disable copy, paste, ^V,^R,^C, ^D for certain columns (Q-U) of the workbook so that user is forced to enter data manually on these columns.
it was possible to disable pasting in an Excel workbook. He didn't want Copy disabled, as he needed to paste data out of this tool into other workbooks, but just wanted Paste and Paste Special disabled while viewing this particular workbook.
Public Sub TogglePaste(booPaste As Boolean) Dim cmb As CommandBar, cbc As CommandBarControl, cbp As CommandBarPopup Dim cbpEdit As CommandBarPopup, cbcPaste As CommandBarControl Set cmb = Application.CommandBars(1) For Each cbp In cmb.Controls If cbp.ID = 30003 Then Set cbpEdit = cbp Next cbp For Each cbc In cbpEdit.Controls If cbc.ID = 22 Or cbc.ID = 755 Then Set cbcPaste = cbc cbcPaste.Enabled = booPaste End If............................
Is it possible to open a workbook via vba, but disable the macros? I know this sounds strange, but the workbook is coded to prevent users from saving it, and the only way to save it is to either open it with macros disabled or change the variable OKtoSave to true, but the variable is global only to the sheet and I can't find a way to change it through a macro written in my personal.xls workbook.
I have a macro in a workbook template,that when the workbook is open it populates a cell with the date and time such as 111711.507. This becomes the contract number for this workbook.. They complete the form or workbook and save it. The next time they open the saved workbook the macro runs and changes the contract number to a new number. I want to disable the macro on the saved workbook from changing the number.
I have a workbook that has a macro that needs to run before it is closed. I have a button on my sheet that runs that macro and then closes the sheet. Is there a way that I can disable the "X" at the top right hand of the workbook and force the user to close the workbook via my button?
I have a workbook in which i do not want the end user to be able to drag and drop cells. I noticed that when I set this in the Excel options to disallow this, it is local to the machine. Is there a way I can prevent others from dragging and dropping cells, through vba or other means, without changing the users local machine settings? I also need to prevent CUT and pasting of cells. I also need to leave the cells un-protected, becuase COPY and paste is ok, as it doesnt affect the formulas that refer to the cell. The worksheet and workbook are both protected.
I would like to disable cut/copy/paste and maybe delete inside a worksheet. Reading earlier threads on this subject provided the code to put in the ThisWorkbook module, where it works great for all my worksheets. However, there is one worksheet where it is necessary to have copy/paste, either with control c or right click/copy. Here is part of that code provided by Tom Urtis:
Private Sub Workbook_Activate() Application.CutCopyMode = False Application.OnKey "^c", "" Application.CellDragAndDrop = False End Sub
What do I replace Application with to work on just the worksheet level?
I have a question concerning Macros and the Disable/Enable prompt. My boss has a spreadsheet which has been used for years and he recently wanted to and did remove the macros from the spreadsheet (they were no longer necessary), but the disable/enable prompt still appears when the spreadsheet is opened. I replicated this in a test spreadsheet with a simple insert line macro and received the same results. Is there a way to remove the macros and the disable/enable prompt once they are removed? I know about setting the security to low to not see the prompt, but I would think that once the macros are deleted, the prompt should not appear any more.
I m not able to use the standard Excel Paste Special function when I copied a range of cells in another Excel workbook opened in a separate instance of Excel. Instead, Paste Special thinks that I have copied some non-Excel objects and gave me the Paste As options. This is not the case if I open both workbook within the same instance of Excel. Could you share with us if there is a trick to trigger the normal Paste Special options in such situations (without having to invoke Macro procedures)?
I have an open workbook (A) and this is where the code should reside. I want to use VBA to copy the content of an entire worksheet from a closed workbook (B) to an existing worksheet in workbook A. How would you accomplish this?
I am looking for a code that would copy the data from each worksheet in a given workbook and then paste to just one worksheet within a different workbook. The Sheet names are auto generated when I run this canned report but the naming structure is always the same...the first worksheet is named Repair Details and then the next sheet is named Repair Details_1, the next sheet is named Repair Details_2 and so on for every sheet in workbook. So I would like to copy all of the data(Headers to last cell) and then paste in a worksheet(ex: Master Repair Report.xlsx and the worksheet could be titled Master Repair Details) on a different workbook, then the next sheet would copy from the one under the header to the last record and paste to the same workbook. This process would repeat for every worksheet in the Repair Details Workbook and paste to Master Repair Details worksheet in the Master Repair Report workbook.
I have 2 workbooks. 1 is where data is entered called wksPB, the other is like a database workbook. The wksPB has data to be feed from column B to F and there is a dropdown.
what im looking to do is, if the combobox value is selected as Decline then it should display a messagebox that reference value in cell B is denied. if combobox value is Agreed then the macro should search the database workbook for the text entered in column b of wksPB and then copy data of C:E of wksPB to H:J of database sheet where that text is found and also the approver name in wksPB C24 to the approver cell of where that text was found. I've reached till finding the text but what I get my head twiting on is how to copy the text from wksPB column B:F to database sheet column H:K. Im attaching the sample workbooks and the code where ive reached till.
Attached Files Replacement Records - 2014.xlsx forum file.xlsm
I need to copy a range of values (actually two ranges). The ranges are of fixed size. Le't say A2:D20 and E2:H20.
Both workbooks have the exact same layout, and they both have the same named worksheet (in this case it's called Entry). However the actual filename of the source workbook is unknown. I know numerous users have changed the filename of the xls file.
I want to instruct them to open the old and new workbook, and open a third workbook containing the copy macro, they run the macro and it copies the data.
How can I reference a known worksheet name but of an unknown workbook name esp when the source and destination share the worksheet name?
Code: Sub CopyRow()' 'Copies row to new sheet, highlights it, marks column 'A' as copied. ' Dim cCell As Range Set cCell = Selection.Cells(1, 1) Selection.Copy Sheets("Sheet2").Select Rows("2:2").Select
Is it possible to modify it to paste into a different workbook called c:filesDestination.xlsm, instead of the existing workbook (Source.xlsm)? The destination sheet name is the same (Sheet2). It's OK if both workbooks are open at the same time.