ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Are the macros allowed? (https://www.excelbanter.com/excel-programming/302530-macros-allowed.html)

Milan[_2_]

Are the macros allowed?
 
Hello,

I would like to ask you which VBA property or command should I use if
I want to know if the user allowed usage of macros when he was opening
some Excel file.

Thanks in advance,
Milan.

Dave Peterson[_3_]

Are the macros allowed?
 
If the user allowed macros to run, then you can use anything you want.

But if the user didn't allow macros to run, then any code you try to use won't
be running--so it wouldn't matter.



Milan wrote:

Hello,

I would like to ask you which VBA property or command should I use if
I want to know if the user allowed usage of macros when he was opening
some Excel file.

Thanks in advance,
Milan.


--

Dave Peterson


Milan[_2_]

Are the macros allowed?
 
Thank you. Maybe my question was not written exactly. I have developed
an application in Access which cooperates with some Excel file which
has been opened by user before. I would like to know how can I find
out in Access (i use the command GetObject) if the macros are enabled
or disabled in the opened Excel file. Of course I know how to find it
out but I wonder if there is some simple elegant way.

Thanks, Milan.



Dave Peterson wrote in message ...
If the user allowed macros to run, then you can use anything you want.

But if the user didn't allow macros to run, then any code you try to use won't
be running--so it wouldn't matter.



Milan wrote:

Hello,

I would like to ask you which VBA property or command should I use if
I want to know if the user allowed usage of macros when he was opening
some Excel file.

Thanks in advance,
Milan.


keepITcool

Are the macros allowed?
 
Milan have a look at:

Application.AutomationSecurity


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


(Milan) wrote:

Thank you. Maybe my question was not written exactly. I have developed
an application in Access which cooperates with some Excel file which
has been opened by user before. I would like to know how can I find
out in Access (i use the command GetObject) if the macros are enabled
or disabled in the opened Excel file. Of course I know how to find it
out but I wonder if there is some simple elegant way.

Thanks, Milan.



Dave Peterson wrote in message
...
If the user allowed macros to run, then you can use anything you
want.

But if the user didn't allow macros to run, then any code you try to
use won't be running--so it wouldn't matter.



Milan wrote:

Hello,

I would like to ask you which VBA property or command should I use
if I want to know if the user allowed usage of macros when he was
opening some Excel file.

Thanks in advance,
Milan.




Dave Peterson[_3_]

Are the macros allowed?
 
If you have control over that excel file, can you add a test function?

Option Explicit
Function testme01() As Boolean
testme01 = True
End Function

I don't use Access, but this seemed to return good stuff when called from
MSWord:

Option Explicit
Sub testme()

Dim xlApp As Object
Dim wkbk As Object
Dim macsAvailable As Boolean

Set xlApp = Nothing
On Error Resume Next
Set xlApp = GetObject(, "excel.application")
On Error GoTo 0

If xlApp Is Nothing Then
MsgBox "excel isn't running!"
Exit Sub
End If

Set wkbk = xlApp.activeworkbook

On Error Resume Next
macsAvailable = xlApp.Run(wkbk.Name & "!testme01")
On Error GoTo 0

If macsAvailable Then
MsgBox "macs are available"
Else
MsgBox "macs not available"
End If

End Sub



Milan wrote:

Thank you. Maybe my question was not written exactly. I have developed
an application in Access which cooperates with some Excel file which
has been opened by user before. I would like to know how can I find
out in Access (i use the command GetObject) if the macros are enabled
or disabled in the opened Excel file. Of course I know how to find it
out but I wonder if there is some simple elegant way.

Thanks, Milan.

Dave Peterson wrote in message ...
If the user allowed macros to run, then you can use anything you want.

But if the user didn't allow macros to run, then any code you try to use won't
be running--so it wouldn't matter.



Milan wrote:

Hello,

I would like to ask you which VBA property or command should I use if
I want to know if the user allowed usage of macros when he was opening
some Excel file.

Thanks in advance,
Milan.


--

Dave Peterson


Milan[_2_]

Are the macros allowed?
 
I would like to thank you for your answers!

Milan


All times are GMT +1. The time now is 10:07 PM.

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