Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Prevent Workbook open runing when opening another Excel Doc

  Asked By: Richard    Date: Oct 30    Category: MS Office    Views: 1368
  

I have something that opens workbooks from one workbook. The problem
is when it opens workbooks with startup procedures, like spashscreens
appearing. I tried using a read only argument in the File Open
procedure, but it still goes into error mode as the doc being opened
tries to open a splashscreen.

Is there a way of opening another workbook while disabling any code
from running the the doc you're opening? I would thing Read only would
do it.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Baden Smith     Answered On: Oct 30

Choose:
Tools - Macro - Security - Medium
from the excel  menu BEFORE opening
the file, then choose not to run macros
when you open  the file. (Works in Excel 2002)

(It would at least
make sense to allow setting the security level
higher via a macro, but I don't see a way
to do it.)

 
Answer #2    Answered By: Zeke Thompson     Answered On: Oct 30

It was on medium. The open  code is simple

Workbooks.Open Filename:=Me.DocBox.Value, ReadOnly:=True

or just Workbooks.Open Filename:=Me.DocBox.Value

either way gives me a 401 error  saying you can't open a modal form
while a nonmodal one is open. Well with read  only, I wouldnt think
the workbooks  open code would run at all since the doc  Im opening
that has a startup  screen is opened read only.

Let me change the code:

Dim Docname as string
Docname = Me.DocBox.Value
Workbooks.Open Filename:=Docname, ReadOnly:=True

How do I open docname, so that that docname doesn't run a startup
form?

Workbooks.Open Filename:=docname

It doesnt help to error handle the doc I'm opening  it FROM, say
OpenTool.xls

It goes into the error mode  of docname.

 




Tagged: