![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 09:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com