I have a code that opens a workbook and saves it under one file name and then saves it under 2 different file names, but it keeps on saving them as password protected and I can't work out why. Would it be something to do with the code or something else? The following is the code I am using:
It is supposed to bring up an input box, the date entered in input box becomes the date of file. The file is then Saved As. This all seems to work but when I try to open the newly saved file the sheet does not open. Is this a file type issue? Should it be .xls?
Code so Far
Dim InputDate As Variant Dim FileType As String Dim myFileName As String Dim myFolder As String
I have the following code working well. I'd like the pdf to be saved to the users local machine before it emails it. The user must be able to choose the path. How can I do this?
have a code for restricting printing until some cells are filled; however the code is been applied to all the file. I need to apply it to one one sheet. Thanks for your help.....
Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet If Application.WorksheetFunction.CountA(.Range("A11:K11"), ("A13:K13"), ("A16:K16"), ("A19:I19"), ("J18:K18"), ("A22:K22"), ("A25:K25"), ("B63:B64")) < 8 Then MsgBox "Please Complete Information" Cancel = True Else 'Allow printing End If End With End Sub
I have a number of different modules. Each module does something similar, but different to a specific workbook. Instead of running the macro(s) individually is it possible to have a parent-class that calls on each module, and further to have each module *know* which worksheet it should apply to?
Example below:
Code: Sub Cost_Center_Information_File() 'What it does: applied to a worksheet (there are about 15 worksheets in the workbook) it 'will do some formatting manipulations.
how can i do the following using VBA making each cell in column A added to each cell in column B and the result will be in the column C for example c1=A1+B1 c2=A2+B2 c3=A3+B3 ... etc
i know i can do that simply without vba code but I just want to use this method to implement more complex formulas .
I found some username and password login code that I am editing for my needs, but I am having some trouble with it. I keep getting run time error '448': Named argument not found on the following line:
I have a code to verify the user name and password, what I want is counting the times the user enters wrong password and show a msgbox when he enters three continuous wrong passwords:
I have created the following lines which are part of a long code, the code is actually running without errors, but it is not showing the msgbox,
I have a sheet which i made ages ago and cant remember my pw. I can goto the alt, F11 select the macro and run it which i have set from all sheets to hide, and i can change the wording on the sheets but i cant open the code.
Does this mean i will have to forget about it unless i remember the pw?
I have an add-in which I want to share with others, but I want to protect the code from modification.
I know how to apply a password to a VBA project (Tools -> Project Properties -> Protection) but the problem is this: when a colleague installs the add-in, the subroutines within the add-in are not available in the Macros list to be added to the ribbon (in the Customize Ribbon window). The subroutines only appear when I remove the password.
I`m struggling to insert password protection to code.If Yes is selected from the messagebox then a messagebox opens and asks for a password.
Code: Sub DeleteRanges()
If MsgBox("Are you sure you want to delete data ?", vbYesNoCancel + vbExclamation, "Delete data") = vbYes Then With Sheets("Score") For i = 3 To 273 Step 10 .Range("D" & i).Resize(7, 11).ClearContents Next End With End If
I have an excel spread sheet with say 20 or so sheets. Sheet 20 known as "Rates" is hidden. What I would like to do is when the user presses a command button say on sheet 1 he is asked for a password which will unhide the Rates sheet . If he gets it wrong a message pops up say incorrect please try again or have an exit button to cancel.
I have a workbook whose worksheets I want to protect on open, and also want to unprotect by way of a module. The protect code is:
Code: Private Sub Workbook_Open() Sheets("Cornealrings").Protect Password:="elohim" Sheets("Ferrararings").Protect Password:="elohim" Sheets("Kera Rings").Protect Password:="elohim" Sheets("IS CALCULATOR").Protect Password:="elohim" Sheets("IS Manager").Protect Password:="elohim" End Sub
The unprotect code is:
Code: Sub Unprotect() Sheets("Cornealrings").Unprotect Password:="elohim" Sheets("Ferrararings").Unprotect Password:="elohim" Sheets("Kera Rings").Unprotect Password:="elohim" Sheets("IS CALCULATOR").Unprotect Password:="elohim" Sheets("IS Manager").Unprotect Password:="elohim" End Sub
The code stops at the first line of the unprotect event, with the message that the password is not correct. If I try to manually unprotect, the password is accepted.
i currently have created a macro for copy a selection of cells from one work book to another. The file were i am copying the cells from is Track_&_Trend_00.xls. In this there is a password to open and modify. The sheet that the cells are being pasted to is TRACK & TREND.xls. There is no password on this. My macro runs fine only that midway through it asks for the password to open and the password to modify for the sheet Track_&_Trend_00.xls.
I wonder ifany one would know about entering input lines of code below to automatically put these passwords in and not having the two password dialog boxes pop up midway through running the macro.
I am trying to add a command button that will set a custom view, password protect all worksheets, and finally password protect the entire workbook structure. The code I am using will correctly set the view and add the password to the worksheets, but it will not apply the password to the workbook structure. What do I need to add?
I have created a workbook that mostly works with VBA codes. Within the code I have ensured that certain worksheets remain hidden. However, I have also written a macro to access what I called the ADMIN worksheet, which has several commands enabling updates and troubleshooting. Long story short, I would ideally like to prevent users from accessing that worksheet. I have already created a prompt (Msgbox) asking the user if he/she wishes to proceed with the macro but I would prefer being able to have a password prompt to run the macro.
Am trying to find the VBA code to "ask a user for the password to unhide multiple sheets/tabs"
I have got the script for unhiding all sheets which is:
Sub Sheets_Unhide() Dim sh As Worksheet For Each sh In Worksheets sh.Visible = True Next End Sub
What i would like though is for it to prompt with a password first before the code is executed for unlocking 50 odd sheets.. I know its not 100% fool proof, but would do for what i need!
I have a protected sheet so specific people can only see certain things. I would like code to Unhide a tab called "Estimating" and unhide Rows 2 through 9 and rows 24, 26 and 27.
I have a 2010 excel workbook with several locked worksheet (to which I manage the PW). I and another staff member manage different section of the macro but the other staff member doesn't have access to the locked areas.
Is there a way I can encrypt the password within VBA so it's not visible to the other staff member?
Locking the VBAProject doesn't work as the other staff member has to be able to edit his VBA section.
Many staff run the macro (via a button) and don't need to access the Macro and don't have access to the protected sheets.
I understand excel isn't ideal with PW protection for people wanting to bypass the protection and this isn't an issue.
I've used VBA to make a picture appear when all the correct answers have been entered and it all works well. However, not to be too mean to 15 year olds, many of my students can be devious little feckers, and I want to hide and password protect the VBA code so that they can't just change the pictures visible section to true. I can password protect the workbook and worksheet, but not the VBA.
I'm entering the Visual Basic editor and I can see my simple script. I then click Tools - VBproject properties - protection. I'm clicking the "Lock Project for Viewing" box then filling in the password and confirming the password and clicking OK. But I can still see and edit my script, despite protecting the sheet and workbook.
When opening a new Excel file, it is asking me for a password to an old excel file that was password protected, which I have deleted from my computer. It is still asking for this password every time I open a new or existing file. When I hit cancel it lets me open the file.
I have a spreadsheet, which has certain worksheets that are password protected. I need to make changes to some of the formulas, and the VBA modules, however I cannot remember the password!! Is there a way of identifying the password??
Is there a way too get the SaveAs box come up with a marco? When you go too file and save, a box comes up and lets you choose where and what you save. I would like too have it come up with a command button if its possible.
I'm running a macro in a template and trying to save the results to a different folder. I want the file name to be blank in the Saveas Text box of the UI also. Unfortunatley my code is bugging out & I can't work out why.
An already existing file will be changed by my macro and at the end I want the user to save the file with a different name in a different directory with the option to change the filename or directory. Therefore I use the excel-standard-dialog "save as". But I want the dialog to start in another path as the path the original-file is stored in. But also I use the ChDrive and ChDir Parameters the dialog even starts in the original-file-path. I think this is standard for the dialog and I should maybe use a parameter in the show-arguement? The code is below.
Option Explicit Sub SaveMyFile() Dim xFileName, xAnswer ChDrive "J" ChDir "J:myfolder" xFileName = "testme.xls" xAnswer = Application.Dialogs(xlDialogSaveAs).Show(xFileName) End Sub
By Code I am trying to SaveAs the present Workbook : Only in the same directory as the present Workbook- but with a different file name. The new file name would be :"the Filename of the Active Workbook" + " ("D9") of the Sheet("ADMIN")". This macro will only be run from the Sheet("Admin").