Avoid asking to open with macros

B

Basil

Hiya

I am copying a workbook from within Access and opening it... every time I do this it pulls up a prompt asking to allow macros or not. How do I bypass the prompt - it doesn't matter if the macros are activated or not (but preferrably yes)

Any ideas

Basil
 
T

Tom Ogilvy

Are you opening the workbook manually, with a macro, by linking?

The obvious answer is to lower the security level although that is
undesirable.

--
Regards,
Tom Ogilvy

Basil said:
Hiya,

I am copying a workbook from within Access and opening it... every time I
do this it pulls up a prompt asking to allow macros or not. How do I bypass
the prompt - it doesn't matter if the macros are activated or not (but
preferrably yes).
 
B

Basil

I'm opening it with this code (written in Access):
Master = "M:\RPH - Reporting\Reporting Components\Master External Patient Report.xls"
TargetFile = "M:\Patient Flow Team\External Reports\Patient Reports\" & ReferringTrust & ".xls"

an if dir(targetfile) then kill end if statement is here

FileCopy Master, TargetFile
Set XLObject = GetObject(TargetFile)
With XLObject
.Application.Visible = True
.Parent.windows(1).Visible = True
.Sheets(3).Range("A9").CopyFromRecordset rstpreop
.Sheets(3).Range("N1:p1").EntireColumn.Delete
.Sheets(2).Range("A9").CopyFromRecordset rstref
.Sheets(4).Range("A9").CopyFromRecordset rstbl
.Sheets(5).Range("A9").CopyFromRecordset rstip
.Sheets(6).Range("A9").CopyFromRecordset rstpostop

End With

etc...

I'm happy to lower whatever settings - but I have tried taking off the "macro virus protection" in the master file's options and it made no difference to the copy (the target file).

Thanks,

Basil
 
T

Tom Ogilvy

Security is an Excel/Application level setting. It is not governed by
anything in the workbook.

--
Regards,
Tom Ogilvy

Basil said:
I'm opening it with this code (written in Access):
Master = "M:\RPH - Reporting\Reporting Components\Master External Patient Report.xls"
TargetFile = "M:\Patient Flow Team\External Reports\Patient
Reports\" & ReferringTrust & ".xls"
an if dir(targetfile) then kill end if statement is here

FileCopy Master, TargetFile
Set XLObject = GetObject(TargetFile)
With XLObject
.Application.Visible = True
.Parent.windows(1).Visible = True
.Sheets(3).Range("A9").CopyFromRecordset rstpreop
.Sheets(3).Range("N1:p1").EntireColumn.Delete
.Sheets(2).Range("A9").CopyFromRecordset rstref
.Sheets(4).Range("A9").CopyFromRecordset rstbl
.Sheets(5).Range("A9").CopyFromRecordset rstip
.Sheets(6).Range("A9").CopyFromRecordset rstpostop

End With

etc...

I'm happy to lower whatever settings - but I have tried taking off the
"macro virus protection" in the master file's options and it made no
difference to the copy (the target file).
 
T

Tim Williams

The whole point is that it's for *security*

If it could be changed from VBA then it would be useless.

tim
 
Top