![]() |
"Activeworkbook" function not valid when workbook embedded in Lotus Notes?
I have an Excel workbook that has a workbook_open() sub that maximizes
the screen and password-protects all of the worksheets. This sub works fine when I save the file on my hard drive or on the network. However, when I embed the file in a Lotus Notes database, the macro immediately errors out on the first line of code (ActiveWorkbook.Unprotect Password:="Password"). It's as if the file is no longer recognized as an Excel file. Any thoughts on how I should rewrite this so that it works both when saved on a network and in Lotus Notes? Sub Workbook_Open() 'I put in this first line of code to find out what the activeworkbook name was upon opening from Lotus Notes. It still errors out (works fine saved on the network). MsgBox "The name of the active Workbook is " & ActiveWorkbook.Name MsgBox "The name of the active Sheet is " & ActiveSheet.Name ' Maximize all windows ActiveWorkbook.Unprotect Password:="Password" Application.WindowState = xlMaximized ActiveWindow.WindowState = xlMaximized ActiveWorkbook.Protect Password:="Password", Structu=True, Windows:=True ' Opens workbook to Table of Contents cell A1 upon opening the workbook. Sheets("Contents").Select Range("a1").Select ' Show splash screen upon opening the workbook SplashForm.Show ' Password-protect all worksheets but lets macros hide/delete Application.ScreenUpdating = False Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets ws.Protect Password:="Password", userinterfaceonly:=True, AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True ws.EnableSelection = xlNoRestrictions Next ws Application.ScreenUpdating = True End Sub |
All times are GMT +1. The time now is 07:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com