Disabled "Delete" For One Workbook Turned Out To Be Applied To Every Workbook...
Jul 13, 2009I wanted to disable the function "Delete" when right-clicking on worksheets.
I copy paste the following VBA code in every sheet code :
I wanted to disable the function "Delete" when right-clicking on worksheets.
I copy paste the following VBA code in every sheet code :
Is there a way to prevent a workbook from opening unless macros are allowed?
View 2 Replies View RelatedI have a workbook with 33 worksheets and more than 150 charts. Now, when I right-click on a chart to access "Source Data" for example, I get a message saying "No more new fonts may be applied in this workbook". Then I have to click "OK" about a dozen times before I get access to the dialog box. Curiously, it happens for some charts and not for some others.
View 7 Replies View Relatedwhen i put a file across a network, it should be shared among all the users, but it appears as read only file and the option of track changes in the tools function is disabled. However, when i open an excel file in a stand alone pc, and use the track changes option, i get the file as (shared) as the header. what is the significane or meaning of this word "shared" in a stand alone pc?
View 2 Replies View RelatedMy macros don't work when the workbook is shared. They are not stored in my personal workbook and so are available to all users. What's going on?
View 3 Replies View RelatedIf a user disables macros when opening a file, is there a way to have the excel file automatically close?
I have a large worksheet that for some reason I can’t share.
-It does not have any lists, that I know of, do not know how to see if there are any
-It does have validation, but I have other workbooks with listed validation that are shareable
-It is not protected
-Does not have any named ranges
-Is not read only
-I have saved it as another file name and no luck there
-I have copied the one sheet I really need into a separate file to try that it did not work,
I'm trying to find a way to save a single sheet of an excel workbook and in the same process delete all vba code and shapes from the new single sheet workbook. I was looking around and found this code which does save only the single sheet to a new one sheet workbook but doesn't delete the vba and shape that I have used to assign macros to in the original.
Code:
Sub SaveSheetAsNewBook()
Dim wb As Workbook
Dim InitFileName As String
Dim fileSaveName As String
Dim wshape As Shape
InitFileName = ThisWorkbook.Path & Format(Date, "mm.dd.yy")
[code]....
I wrote a code in unshared workbook and it works fine. But when i make it shared i get Run-time error '1004' Delete method of worksheet class failed.
The Deleting of worksheet only occurs once (when the new wb is created) so is there i can unshare and share it back when the process is complete?
I have a workbook with macro button to run some vba, if i want the button to disable when the user make copies of the workbook (date created is later than original wb saved time) what codes to add in the VBA?
what i assume is to add the time to a cell when the wb is saved, when the wb opens, it check for that cell if the same with the date created, if different, then disable the macro button.
why do I get this message, excel won't let me change anything:
"No more new fonts may be applied in this workbook"
The worksheet has whole bunch of charts and I'm moving things around but it won't let me it gives me the above error message. There is no lock in the spreadsheet.
I want to have the macro delete the color applied once a new "Row" is selected!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim RR As Range
Set RR = Target
Cells(RR.Row, 2).Interior.ColorIndex = 36
Cells(RR.Row, 3).Interior.ColorIndex = 36
Cells(RR.Row, 4).Interior.ColorIndex = 36
End Sub
I have a workbook called wb1 stored in folder C:folder1.
I open the workbook and make some changes to it.
At that point I want to have a macro that will save the workbook with all the changes made in folder C:folder2, under the new name wb2, and somehow delete wb1 from C:folder1.
I have a problem deleteing a new workbook that has been .Add[ed].
When saving the active workbook as a new workbook the user is prompted for a file name via a userform.
If the new file name is the same as an existing workbook the error handle restarts process ,adding another new workbook.
or if the project number is unique it is saved ...
Is it possible for a workbook to delete itself after two weeks or by date since putting in VBA codes?
Or does it have to be active to be able to delete itself.
I'll be going away for a holiday in two weeks (yepeee) and the person who's taking over my place will only use it on first day of my absent.
I do not want others to use my file (of course I'll back it up before I'll go).
I want to delete all macros from my workbook (so it will work well in Mac 2008). I went to Alt-F11 and deleted all Macros there and check every sheet and found no references. I did all that and when I try to open it in Excel for Mac it says there are still Macros.
How can I ensure my workbook has no macros?
I am running VBA that will open a new workbook, at the end of that VBA code I have a line of code that reads:
Code:
Sheets("Sheet1").Select
ActiveWindow.SelectedSheets.Delete
When the code hits those lines it throws a VBA error 400. What do I need to do to have Sheet1 deleted from the "new" workbook?
Now that the code is configured to do what I want, can someone assist me in adding a code that will delete the expired file after the third attempt of the user trying to open an expired file.
Private Sub Workbook_Open()
Dim StartTime#, CurrentTime#
Const TrialPeriod# = 1 '< 1 days trial
Const ObscurePath$ = "C:"
Const ObscureFile$ = "LBFileLog.Log"
'*****************************************
If Dir(ObscurePath & ObscureFile) = Empty Then
StartTime = Format(Now, "#0.#########0")
Open ObscurePath & ObscureFile For Output As #1
Print #1, StartTime....................................
if it is possible to delete the current workbook that is open?
I'm thinking of using an add-in to delete the workbook i'm viewing
Delete All Names in a workbook. Maybe delete names one time?
View 2 Replies View RelatedI want to create a macro to check through all sheets in an active work book, if a sheet is empty, then delete it?
View 2 Replies View RelatedHow to delete all defined names from a workbook
View 14 Replies View RelatedI currently have the code below that closes all but 1 sheet in my workbook called Main
Is there anyway i can clear a range of cells on a couple of sheets within the workbook when save is pressed?
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
For a = 1 To Sheets.Count
If Sheets(a).Name "Main" Then Sheets(a).Visible = 2
Next a
End Sub
ive tried creating a macro/code that when you open a certain workbook it automatically deletes the contents. you see i have a workbook containing 100 sheets that i need to update each week but i have to delete all the contents first, is there a quick way to do this when i open the workbook up?
View 9 Replies View Relatedmy code to loop through sheets in another workbook does not want to work. in This Workbook (SourceWb), I copy the current workbook using SaveCopyAs and then reopen the new workbook. from ThisWorkbook (SourceWb), I am trying to delete any sheet between "First" and "Last" where a specific criteria is not met. so starting from the For Each to get my loop values, where PMs is a list of people's initials:
For Each c In Range("PMs")
If c.Value = "" Then GoTo AfterArrays
I don't believe this is possible but I've been wrong before.. Is it at all possible to Kill the current workbook using VBA? I " saved as" in another location and do not wish to keep the current workbook.
View 3 Replies View RelatedIs this possible to set a macro which will delete the file if opened on another computer? Ie say on WB open I want to set a macro that if Environ(“Username”) = “ABCD” then proceed else delete the file permanently from th e other computers machine. If deletion of file is not possible then deletion of sheets or contents of sheets should be deleted. The sheets will be protected. Expecting a solution to delete the file.
View 2 Replies View RelatedI have a workbook in which certain shape objects (2 command buttons and a combobox) can be present on a worksheet if another macro has been run. When a worksheet is closed and another opened, or the workbook closed, I need the shapes to be cut if they are present. There are other shapes on the sheet which must not be deleted.
Each shape has a defined name which is the worksheet name followed by DD, GetStats and Rfrsh
I have tried the code below but get 'The item with the specified name was not found' error message if the one or more of the shapes are not present. The code works for any of the specified shapes that are present.
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Range("f5:i17").ClearContents
If Not Sh.Shapes(Sh.Name & "DD") Is Nothing Then Sh.Shapes(Sh.Name & "DD").Cut
If Not Sh.Shapes(Sh.Name & "GetStats") Is Nothing Then Sh.Shapes(Sh.Name & "GetStats").Cut
If Not Sh.Shapes(Sh.Name & "Rfrsh") Is Nothing Then Sh.Shapes(Sh.Name & "Rfrsh").Cut
End Sub
I am sure I am not using the 'If Not' and 'Is Nothing' properly but can't figure out how it should be.
I have a code which deletes all contents of cell in range except formulas, from sheet 2 to 13. Code works, but I have included toggle button on each sheet to lock/unlock sheets.
If I lock sheets, code doesn't erase cells as needed.
I have figured out code that works for me, but looks like It's not performing quite correct. Although code executes quite quick...
This is my current code :
[Code] .....
How could I rearrange this code to work in proper order ?
That particular question has been solved, but now i need it to work with multiple values from combobox.
So for example,
if "Master" is selected in combobox3, it will delete sheets 7, 8
if "CSR" is selected in combobox3, it will delete sheets 1, 8
if "Original IND" is slected in combobox, it will delete sheets 1,7
The current code will work when "master" is selected, however i am getting compile errors when i select "CSR" or "Original IND"
WhenI select CSR, it does create a new wb for me (without sheets 1,8) correctly but i get a Run time error.
Run-time error '-2147417848 (80010108)': Automation error
The object invoked has disconnected from its clients.
When Original IND is selected, i get a compile error and it highlights 'Make the new workbook active newWBK.Activate