ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem due to password (https://www.excelbanter.com/excel-programming/285745-problem-due-password.html)

FuzzyLogic

Problem due to password
 
Can any one guide to solve out a problem.

I am reading a excel workbook from a Visual Basic application.
I have to do work in this workbook.

1. I have to assign ToolTip to the particular cells.

2. I have to insert additional rows/columns.

I have to do this as per the logic in Visual Basic application.
The problem is that if the program gives run time error when the exce
workbook is password protected and neither allow me to assign toolti
nor the insert rows/columns.

I m using the following commands

ActiveWorkSheet.Cells(9, 9).AddComment "Testing ToolTips"

Activework.Range("C9", "C9").EntireColumn.Insert xlShiftToRight


Any help will be appreciated in this regard.


:

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Problem due to password
 
In xl2000 and earlier you can use the UserInteractiveOnly Property of the
protect method to work with the worksheet without knowing the password.

You can check if the sheet is protected with

Sub Tester5()
If ActiveSheet.ProtectContents _
Or ActiveSheet.ProtectDrawingObjects _
Or ActiveSheet.ProtectScenarios Then
On Error Resume Next
ActiveSheet.Unprotect password:=""
If Err.Number < 0 Then
Err.Clear
MsgBox "Sheet is password protected"
Activesheet.Protect UserInteractiveOnly:=True
End If
On Error GoTo 0
End If


End Sub

In Excel 2002 and later, you would need to know the password.

--
Regards,
Tom Ogilvy




"FuzzyLogic" wrote in message
...
Can any one guide to solve out a problem.

I am reading a excel workbook from a Visual Basic application.
I have to do work in this workbook.

1. I have to assign ToolTip to the particular cells.

2. I have to insert additional rows/columns.

I have to do this as per the logic in Visual Basic application.
The problem is that if the program gives run time error when the excel
workbook is password protected and neither allow me to assign tooltip
nor the insert rows/columns.

I m using the following commands

ActiveWorkSheet.Cells(9, 9).AddComment "Testing ToolTips"

Activework.Range("C9", "C9").EntireColumn.Insert xlShiftToRight


Any help will be appreciated in this regard.


:o


---
Message posted from http://www.ExcelForum.com/




Tom Ogilvy

Problem due to password
 
Whoops, UserInterActiveOnly should be UserInterfaceOnly

Sub Tester5()
If ActiveSheet.ProtectContents _
Or ActiveSheet.ProtectDrawingObjects _
Or ActiveSheet.ProtectScenarios Then
On Error Resume Next
ActiveSheet.Unprotect password:=""
If Err.Number < 0 Then
Err.Clear
MsgBox "Sheet is password protected"
Activesheet.Protect UserInterFaceOnly:=True
End If
On Error GoTo 0
End If


End Sub


--
Regards,
Tom Ogilvy



"Tom Ogilvy" wrote in message
...
In xl2000 and earlier you can use the UserInteractiveOnly Property of the
protect method to work with the worksheet without knowing the password.

You can check if the sheet is protected with

Sub Tester5()
If ActiveSheet.ProtectContents _
Or ActiveSheet.ProtectDrawingObjects _
Or ActiveSheet.ProtectScenarios Then
On Error Resume Next
ActiveSheet.Unprotect password:=""
If Err.Number < 0 Then
Err.Clear
MsgBox "Sheet is password protected"
Activesheet.Protect UserInteractiveOnly:=True
End If
On Error GoTo 0
End If


End Sub

In Excel 2002 and later, you would need to know the password.

--
Regards,
Tom Ogilvy




"FuzzyLogic" wrote in message
...
Can any one guide to solve out a problem.

I am reading a excel workbook from a Visual Basic application.
I have to do work in this workbook.

1. I have to assign ToolTip to the particular cells.

2. I have to insert additional rows/columns.

I have to do this as per the logic in Visual Basic application.
The problem is that if the program gives run time error when the excel
workbook is password protected and neither allow me to assign tooltip
nor the insert rows/columns.

I m using the following commands

ActiveWorkSheet.Cells(9, 9).AddComment "Testing ToolTips"

Activework.Range("C9", "C9").EntireColumn.Insert xlShiftToRight


Any help will be appreciated in this regard.


:o


---
Message posted from http://www.ExcelForum.com/






FuzzyLogic

Problem due to password
 
Thanx Tom

I will try according to your suggestion will inform u accordingly

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com