Disable VBA script creation or modification in MS Office apps - excel

as the title suggests. Allow execution of previously created scripts but disallow creation of new ones or modification of existing script. Blocking of VB doesn't work since the editor spawns as the parent process.

You can always protect the existing VBA project:
From the VBA Editor, select Tools > VBA project properties > Security > Lock project for viewing, enter a password and save.
Additionally, Modern versions of MS Access provide a method to save your database as a compiled executable format (*.accde) which you can then publish to your users without fear of them modifying or inserting VBA code.

Related

Handle loading state of Excel AddIn or preload AddIn on insert

I'm developing an Excel AddIn and faced one issue.
1st issue: When user inserts the AddIn to the Excel (web) - user needs
to click any ribbon command to start loading plugin files.
2nd issue:
When plugin already inserted, the files are being downloaded.
However, if user click any command before files downloaded, nothing
happens.
I can disable all commands and enable them when source code downloaded. BUT this not works when user inserts AddIn for the first time. He MUST click any command to start downloading source code.
Question: is there any solution to force load Excel AddIn source on initial insertion?
P.S.
Startup behavior works only for the next opening of AddIn. If manifest has something similar - would be nice to know.
Env: Excel (on the web), OfficeJS API, Shared runtime, windows (if it's matter)
P.P.S. The problem - user clicks on enabled button to open taskpane, but nothing happens (the downloading just started).

How to give entitlements to Applescript app

I have an application created in Omnis studio where I want the user to be able to press a button to open Microsoft Excel and then paste what is in the clipboard. To do that I have my application call an AppleScript app Seen here:
tell application "Microsoft Excel"
activate
make new workbook
paste special on worksheet active sheet
end tell
However whenever my application calls that script it runs into issues with apple's sandboxing saying that it can't send events to Microsoft Excel.
I read online that in order to get access to sending events in Mac OS you need to have a entitlements.plist file associated with your application. How would I add a entitlements.plist file to my Applescript app so that when it is run it is able to send events to Microsoft Excel?
If you do not sell the app and just use it for your own, best would be to deactivate sandboxing. Your app will still run by righclicking it > open.
If you already have sandboxing enabled there already must be a YOURAPPNAME.entitlements file inside your application structure (not in the compiled app, but in your source code) because sandboxing has to be enabled in that file.
I don't know Omnis studio, you may try using XCode instead which supports entitlements files from the scratch - even if you have to go with applescript objective-c instead of plain applescript.
if you manage to find that file you need to add a new key/value to it like so for addressing Excel:
key: "com.apple.security.temporary-exception.apple-events"
value (type array):
Item 0 > "com.microsoft.excel"
But watch out - if you want to stay in sandbox, from OSX 10.14 there's a new security policy called "security integrity protection" (SIP) by Apple where users also need to allow your app to automate other apps, checkout this thread: "because it is not SIP-protected" - Apple event error in OSX Mojave
To bypass this beginning from 10.14 you also have to add a new line to your info.plist file
key: NSAppleEventsUsageDescription
value: [Some description why you need to use AppleEvents]
I don't know if third party editors will follow the speed Apple provides in things of changes.
This is an older post, but why would you create an Excel file like that, if its just columns of data, just export a CSV file, that Excel can easily open...

Solution for Deploying & Updating Document Level VSTO Addin Including the Document

Do any of you have advice on methods for deploying an office VSTO addin, especially Excel, that makes it easy to update and deploy the document as well as the addin.
I have a document level addin for Excel 2010 that I created using VSTO. I currently deploy it using click once. However, this has a few problems. The first problem is that I publish it to ftp then users install it from my website. Since the document and addin are downloaded from the internet, I obviously have trouble getting proper permission for the addin to run and the document to be trusted. Currently I just have users manually adjust permissions and grant access when the solution is installed. That part works and is fine, but if any of you have suggestions on how to automate this that would be great.
The second problem, the main one I am wanting help with in this post, is deploying updates. I generally like using clickonce because of its ease of installation and automatic update features. The solutions I develop are used in rapidly growing fast changing companies, which means I am often making updates. Click once makes it easy enough to update the "code" or addin itself. I just have it automatically check for updates when it is started, and if there are updates it will prompt the user to download them. But what about the document? My solution doesn't only include the code. It also includes the highly customized Excel workbook.
When the solution is initially installed a copy of the workbook is just downloaded to the local computer. But what about after it is deployed to dozens of computers? Does a document level change (adding a column for example) mean going to each computer and downloading the updated workbook manually?
Surely there is a better way to automatically deploy updated versions of the workbook. Any suggestions?
Here are a few ideas I thought of:
Use some installer other than clickonce. Any suggestion on one that allows easy automatic updates?
Somehow package the workbook as an application resource. I have actually done this in some situations, but not in cases where the document itself included a VSTO addin.
Related to the previous idea. Make a "wrapper" project that includes the workbook & VSTO addin. Then the addin would be launched by clicking on a regular icon on the desktop, which would download the workbook (if an update was needed) then open it in Excel. I would prefer that method of launch over simply opening the workbook anyway.
Note: No user data needs to be preserved in the Workbook when an update is done. The old version could simply be overwritten by the new one. The workbook gets all its data from an SQL server.
You could use a Visual Studio Setup Project which leverages Windows Installer. See this deployment walkthrough guide on using VSTO 4.0.
In Visual Studio 2012, support for Setup Projects is being deprecated in favor of InstallShield LE which is another alternative.

Open an Excel file in running instance of Excel with Task Scheduler

I use Task Scheduler to automate a variety of nightly tasks using Excel. Typically the task opens a new instance of Excel, which in turn opens a specified file, which does some stuff and closes itself (and Excel).
Now I have a task that requires an add-in, and use of the add-in requires separate authentication. There is no way to pass my credentials - I have to manually authenticate when the add-in loads. Because the old-fashioned way always launches a new (unauthenticated) instance, I can't figure out how fully automate tasks that require the add-in.
One workaround would be to open an instance of Excel before I leave, authenticate for the add-in, and leave that instance open. Then I could theoretically schedule the opening of some file within that instance (as opposed to launching a new instance to open the file, as described above) and do whatever the tasks were that required the add-in.
Is it possible to do this, either directly by defining the task a certain way, or in a .bat file that I can run on a schedule?
I have a very similar problem and wondering if you have solved this problem through the VBA (getobject(), sendmessage method etc) yet.
I created a seperate question on this just show what I have done. Windows FindWindows and SendMessgae for Auto-authentication excel VBA
Basically I am stuck on how to pass user name and password to the add-in pop up window.
Thanks a million times:)

Unable to create Excel macros on particular machine (possible Windows Group Policy issue?)

I have a Windows 2003 Server box with Excel 2010 installed, upon which I am unable to create new or execute existing macros in spreadsheets. Note: this machine is in a Windows Domain (and I am not getting much help from the network folks here.)
I can and have edited the macro security levels within Excel (File, Options, Trust Center, Macro Settings --> Enable All Macros) but despite this, when I try to:
Open a spreadsheet with macros, I get an exception "Excel found unreadable content...." which goes on to refer to the VBA macros within the spreadsheet
Create a new macro in a brand new spreadsheet created on this machine, all the toolbar buttons providing access to the VBA editor are disabled.
Could this be a Group Policy setting that allows me to edit the macro security settings, but overrides these settings and prevents me from actually creating, editing, or executing VBA macros? (If so, does anyone happen to know which group policy setting I should be looking for?)
I've run rsop.msc (Resultant Set of Policy) on the machine and looked through every single thing under both Computer Configuration and User Configuration, but I don't see anything related to Excel (or Office) Security/Macros.
In this case, the problem was that Visual Basic for Applications hadn't been installed when Excel itself was installed.
(As usual, Microsoft could do a much better job of alerting the user to this unusual configuration, but what can you do.)

Resources