If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
On error
Hi, I have code as below which will update links..
On error sheet will be unlocked.. how to lock the sheet again and exit sub? Sub ref() ActiveSheet.Unprotect Password:="abc" ActiveWorkbook.UpdateLink Name:= _ "asdasd", _ Type:=xlExcelLinks ActiveSheet.Protect Password:="abc" End Sub |
#2
|
|||
|
|||
On error
Try using the On Error statement.. Refer the below link
Sub ref() On Error GoTo Handler ActiveSheet.Unprotect Password:="abc" ActiveWorkbook.UpdateLink Name:= _ "asdasd", Type:=xlExcelLinks ActiveSheet.Protect Password:="abc" Handler: ActiveSheet.Protect Password:="abc" End Sub If this post helps click Yes --------------- Jacob Skaria "Kashyap" wrote: Hi, I have code as below which will update links.. On error sheet will be unlocked.. how to lock the sheet again and exit sub? Sub ref() ActiveSheet.Unprotect Password:="abc" ActiveWorkbook.UpdateLink Name:= _ "asdasd", _ Type:=xlExcelLinks ActiveSheet.Protect Password:="abc" End Sub |
#3
|
|||
|
|||
On error
Kashya, this time with the link.
http://www.excel-vba.com/vba-code-2-2-error.htm If this post helps click Yes --------------- Jacob Skaria "Kashyap" wrote: Hi, I have code as below which will update links.. On error sheet will be unlocked.. how to lock the sheet again and exit sub? Sub ref() ActiveSheet.Unprotect Password:="abc" ActiveWorkbook.UpdateLink Name:= _ "asdasd", _ Type:=xlExcelLinks ActiveSheet.Protect Password:="abc" End Sub |
#4
|
|||
|
|||
On error
Thanks Jacob..
"Jacob Skaria" wrote: Try using the On Error statement.. Refer the below link Sub ref() On Error GoTo Handler ActiveSheet.Unprotect Password:="abc" ActiveWorkbook.UpdateLink Name:= _ "asdasd", Type:=xlExcelLinks ActiveSheet.Protect Password:="abc" Handler: ActiveSheet.Protect Password:="abc" End Sub If this post helps click Yes --------------- Jacob Skaria "Kashyap" wrote: Hi, I have code as below which will update links.. On error sheet will be unlocked.. how to lock the sheet again and exit sub? Sub ref() ActiveSheet.Unprotect Password:="abc" ActiveWorkbook.UpdateLink Name:= _ "asdasd", _ Type:=xlExcelLinks ActiveSheet.Protect Password:="abc" End Sub |
Thread Tools | |
Display Modes | |
|
|