emaar

emaar

New Member
Joined
Sep 1, 2011
Messages
5
Hi I want to write a vba code doing the following:
My workbook is protected with a password. However when I update my workbook with a data web import it must be unprotected. After finishing the import and having updated the workbook, I want my vba proceedure to protect the workbook again with the same password. Does anyone have a routine for this?

Einar
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi I want to write a vba code doing the following:
My workbook is protected with a password. However when I update my workbook with a data web import it must be unprotected. After finishing the import and having updated the workbook, I want my vba proceedure to protect the workbook again with the same password. Does anyone have a routine for this?

Einar

You should be able to do that using "Record Macro".
 
Upvote 0
You might get away with using the UserInterfaceOnly aspect of protecting a sheet (just rtealised you said the workbook was protected but…). Check it out, it only needs to be executed once, and remains in force until the workbook is closed again. It allows code to change the sheet, but not people.
 
Upvote 0
You might get away with using the UserInterfaceOnly aspect of protecting a sheet (just rtealised you said the workbook was protected but…). Check it out, it only needs to be executed once, and remains in force until the workbook is closed again. It allows code to change the sheet, but not people.

Thanks for reply, but I do not know what you mean with UserInterfaceOnly?
 
Upvote 0
I said:"UserInterfaceOnly aspect of protecting a sheet"
In help, under worksheet.protect you have the likes of:
expression.Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly, AllowFormattingCells, AllowFormattingColumns, AllowFormattingRows, AllowInsertingColumns, AllowInsertingRows, AllowInsertingHyperlinks, AllowDeletingColumns, AllowDeletingRows, AllowSorting, AllowFiltering, AllowUsingPivotTables)


Check it out.
 
Upvote 0
I said:"UserInterfaceOnly aspect of protecting a sheet"
In help, under worksheet.protect you have the likes of:
expression.Protect(Password, DrawingObjects, Contents, Scenarios, UserInterfaceOnly, AllowFormattingCells, AllowFormattingColumns, AllowFormattingRows, AllowInsertingColumns, AllowInsertingRows, AllowInsertingHyperlinks, AllowDeletingColumns, AllowDeletingRows, AllowSorting, AllowFiltering, AllowUsingPivotTables)


Check it out.

OK thanks
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,704
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top