Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Automation Security and unexpected program termination

I want to open an Excel workbook which I know is read-only (password
protected), and contains code. To load the file and to disable the code, I set
Application.AutomationSecurity = msoAutomationSecurityForceDisable, and then
open the workbook:
Application.Workbooks.Open Filename:=strFileName,
WriteResPassword:=strWriteResPassw
This works, but also the code execution stops without any error messages. Is
this the expected result of this sequence? The problem does not occur when I
do not alter the default automationsecurity setting.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automation Security and unexpected program termination


why not open the workbook in read only mode?

Application.Workbooks.Open Filename:=strFileName, Readonly:=true


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=165912

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Automation Security and unexpected program termination

Because I want the user be able to edit the file conveniently (without the
events being triggered, which is why I want the vba code on the file
disabled, but disabling events is not an option, because I want them to
remain active on other open files) and save it under the original name.

"joel" wrote:


why not open the workbook in read only mode?

Application.Workbooks.Open Filename:=strFileName, Readonly:=true


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=165912

Microsoft Office Help

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Automation Security and unexpected program termination

It's almost as if the code that is being executed (which is, by the way, in
an add-in) switches itself off. It also happens when I choose to switch off
the macro attached to the file to be opened via the UI that appears when I do
not set the automation security. However, when I choose to activate the macro
at that point, the code execution does continue without problems. When I
place an 'on error resume next' statement before the line where the file is
opened, the problem remains.

"Arne" wrote:

I want to open an Excel workbook which I know is read-only (password
protected), and contains code. To load the file and to disable the code, I set
Application.AutomationSecurity = msoAutomationSecurityForceDisable, and then
open the workbook:
Application.Workbooks.Open Filename:=strFileName,
WriteResPassword:=strWriteResPassw
This works, but also the code execution stops without any error messages. Is
this the expected result of this sequence? The problem does not occur when I
do not alter the default automationsecurity setting.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automation Security and unexpected program termination


You can open the workbook in safe mode which doesn't run any macros but
still allow changes to be made. the only way I know of opening in
safemode is from the command line prompt using /s.


Comspec = Environ("Comspec")
ExcelExe = Application.Path & "\excel.exe"
FName = "c:\temp\book1.xls"

CommandLine = Comspec & " /k " & Chr(34) & _
ExcelExe & Chr(34) & " /s " & FName

Shell (CommandLine)


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=165912

Microsoft Office Help



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Automation Security and unexpected program termination

OK, thanks. See if I can and want to use that bypass.

"joel" wrote:


You can open the workbook in safe mode which doesn't run any macros but
still allow changes to be made. the only way I know of opening in
safemode is from the command line prompt using /s.


Comspec = Environ("Comspec")
ExcelExe = Application.Path & "\excel.exe"
FName = "c:\temp\book1.xls"

CommandLine = Comspec & " /k " & Chr(34) & _
ExcelExe & Chr(34) & " /s " & FName

Shell (CommandLine)


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=165912

Microsoft Office Help

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program Security Staanley Excel Discussion (Misc queries) 2 February 15th 08 08:59 PM
security/protecting an excel program gunman[_10_] Excel Programming 1 October 5th 05 10:19 PM
Error or Unexpected Behavior with Office Automation when you use early binding Barb[_5_] Excel Programming 3 September 15th 04 03:17 PM
Excel Error Reports and Unexpected Termination of Program C. Bailey Excel Programming 0 June 16th 04 12:35 AM
Excel Automation with Security Problems Harry[_4_] Excel Programming 0 May 12th 04 08:56 AM


All times are GMT +1. The time now is 09:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"