Excel - Form/ActiveX Control Properties Not Available - exception

In Excel 2010, is there a setting that prevents a user from being able to access the properties of a form or ActiveX control?
I am working with a user who can open up an Excel file and insert controls (both form and ActiveX) on a worksheet. However, when that user clicks any object and goes to it's properties, the properties for the sheet are displayed instead of the properties for the selected object.
Additionally, any macros that attempt to access the control through the sheet throw an "Object doesn't support this property or method" error, because the control is null. See the example below that attempts to reference a dialog control named "CommonDialog1" on a worksheet named "AddParts":
Worksheets("AddParts").CommonDialog1.ShowOpen
I am able to run this exact same macro on other computers from the same workbook without any issues. Is there some user setting in Excel that is preventing the user from being able to access objects?

To answer the above questions:
1) The workbook is unprotected
2) Enable all ActiveXControls without restrictions is checked. However, I was able to work around this issue by using the built-in Application.GetOpenFilename VBA function to get the file dialog instead of using the ActiveX dialog control.
I'm still not sure why the ActiveX control wasn't available to the user, but this work-around was able to allow the user to use the Excel Workbook.

Had this exact problem and found this solution
Close Excel.
Start Windows Explorer.
Select your system drive (usually C:)
Use the Search box to search for *.exd
Delete all the files it finds.
Start Excel again.
"Cannot insert object" error when adding ActiveX control like Microsoft DataGrid to Excel sheet

Related

Open print preview dialog programmatically?

I am creating an invoice tool within Google Sheets. The way it works is that after all the data is entered, a script is running, creating a sheet with the actual layed-out invoice.
I know that there is a way to automatically export sheets as PDF (by calling the document url with the "export?exportFormat=pdf" argument). But I don't want to export directly, I just need the "Print" dialog (File->Print) to pop up automatically so the user can adjust the settings before printing. (I know, it's not a big deal to press cmd+P yourself, but having the dialog open automatically would streamline the whole process a bit).
Is there any way to do that? I haven't found anything helpful within the documentation.
There isn't a way to do that with Google Apps Script services but you might do that by using client side code.
Related
JavaScript print preview

How can I read the User properties saved in the File/Project properties menu?

In the Google Apps Script editor, I can set a user property by opening the File > Project properties menu, and then selecting the "User properties" tab. However, it seems that the PropertiesService is unable to access the values set in this menu. Is there a way I can access the values set through this menu in my script?
Set {"propertyA", "valueA"} in "User Properties" tab (pictured
below)
Run PropertiesService.getUserProperties().getProperties()
Output: {}
If I were to then run PropertiesService.getUserProperties().setProperty("propertyB", "valueB"); and then getProperties() again, the output would update to show only {propertyB=valueB}.
Similarly, as my searches all direct me to the PropertiesService, where can I find documentation about these menu properties? (Specifically, I'd like to know when I should use the menu option versus setting the values programatically.)
No. The GUI for accessing user properties was never updated when the UserProperties class was deprecated in 2014. The issue was finally resolved with the redesigned Apps Script IDE in 2020, which removed the GUI for accessing properties altogether.
Although it is possible to access the legacy IDE and modify script properties via the menu, the only way to access user properties is programmatically with PropertiesServices.getUserProperties(). Google has also published a guide to the Properties service.

Access - Scripts Bound to Google Sheets

From the documentation of the the bound script:
https://developers.google.com/apps-script/guides/bound
"Only users who have permission to edit a spreadsheet, document, or form can run its bound script. Collaborators who have only view access cannot open the script editor, although if they make a copy of the parent file, they become the owner of the copy and will be able to see and run a copy of the script."
This feature is kinda limited. I have created a big sheet that are used by multiple users. I need the script to be executable by Read Only access users. The script that I created are not making changes to the document, so it should not affect by the access level of the users.
Administrator have Edit access to the document. They have access to all calculation/ configuration cells/ sheet.
Managers have Edit access to the document. Managers have Edit access to most of the cells/ sheet. Managers task is to update the cells
All remaining users only have Read Only access to the document. They can view cells and the automated calculation.
Because the cells have too many columns, I have created a button (eventually I want to move it to onOpen) for easy navigation to a specific cell. This is done dynamically based on today's date.
This is working fine as expected for Administrator and Manager (have Edit access), however not available for the rest of the users with Read Only access.
Is there any workaround for this?
Thanks
Unfortunately not. You are the edge case. The whole point of GAS is to make editing easier, providing tools. A Google document/Spreadsheet/etc. normally isn't THAT hard to maneuver through.
However, if your REALLY want viewers to see specific parts of your spreadsheet, but not edit it, you could try making a standalone script. Have it pull data from the spreadsheet using the spreadsheet's id and then project it on the HTML page, in a table or list.
I Agree with EvSunWood, though I would go about the task in a slightly different way. You could give read only access to the main sheet to the user. And then give them full access to a separate sheet with code attached which onOpen updates itself from the original with all of the latest data and then navigates to the appropriate row.
I agree too with this answer, it's not possible to allow view only users to execute scripts, but contrary to using an script to overwrite edited data, I suggest you use sheets/range protection this way we reduce risks like a failure on the script by on open trigger due to "change collisions" caused by several users opening the same file at almost the same time.

Google Spreadsheet - Show sheets depending on type of user

Is there a way, to make a certain sheet in Google Spreadsheets, be editable and accessible to a certain type of user, while not be accessible to another type of user?
I currently have a Google App Script project, that allows a certain user to use an HTML form to input certain parameters, and a Google Spreadsheet is automatically created for him (thus, everything in the spreadsheet is created programatically).
This new spreadsheet should have access by different "types" of users.
A "type" of user just means a specific person that has specific authority over the spreadsheet.
For example:
There are users who would be able to edit anything in the spreadsheet. There are other users who can only read it (but not edit it). There are users who would be able to access custom Menus (that allow them specific actions related to the spreadsheet), while other users should not.
For now, I solved the above problem by having 2 types of users:
1)A user that is given "Can Edit" access to the spreadsheet by the creator. This user can edit any sheet in the spreadsheet, and access every custom menu (since those are created in the "onOpen()" trigger, which executes only when the user has "can edit" authority)
2)A user that is just given a "Can View" public link to the spreadsheet. This user can only read each sheet of the spreadsheet, but not edit any. He also has no access to any custom menus.
This worked for a while, but now I have new requirements that should allow the 1st type of user, to have access to specific sheets, while the 2nd type of user should not even have read access to them.
Is there a way, using either Google App Script, or other functionality from Google Spreadsheets, to make this happen?
I know sheets can be made visible or invisible, but doesn't that affect every user, even those I want to be able to view and edit them?
If it's possible, I also want to know if it can be done programatically using Google App Script.
Is there also a way to have more functionality restricted to different types of users? What if I want a specific user to be able to edit a certain sheet, but not be able to access specific custom menus?
If it is not possible to do so, the only solution I can think of is to create separate spreadsheets for each of these "restricted features", and give "Can Edit" access in that spreadsheet to each type of user I want to have access to those features.
However, ideally everything should be done in a single spreadsheet, since I want all the information contained in a single access point, and not scattered in different spreadsheets with (maybe) little relation between each other.
Thanks
now I have new requirements that should allow the 1st type of user, to have access to specific sheets
Editors already have access to all sheets.
the 2nd type of user should not even have read access to them.
Well, that would trigger the need for either using a 2nd spreadsheet that imports the data / sheets that you only want the "Can View" users to see or you could go with creating a web app that only displays that data if you just want to stick with 1 spreadsheet (but still 2 urls).
I know sheets can be made visible or invisible, but doesn't that affect every user, even those I want to be able to view and edit them?
This is fairly easy to test manually. Have an editor hide a sheet while a viewer has it open in another window. The sheet will be hidden on both.
I also want to know if it can be done programatically using Google App Script.
yes - SpreadsheetApp.getActiveSpreadsheet().getSheetByName(name).hideSheet()
Is there also a way to have more functionality restricted to different types of users?
If you have the users and their permissions stored some where, then you can control what functions run based on their email.
function myfunction() {
var validUsers = ['ex1#ex.com', 'ex2#ex.com'];
if (validUsers.indexof(Session.getEffectiveUser().getEmail()) >= 0) {
// continue
}
}
What if I want a specific user to be able to edit a certain sheet, but not be able to access specific custom menus?
Use the same technique as above to filter out who should be able to see menus in onOpen().

MS Access property sheet error

I'm having some issues with the property sheets on both MSAccess 2003 and 2010 (I'm using both because our offices are transferring over to access 2010).
Problem : Whenever I want to edit any form, the property sheet displays fine but it won't allow me to select/edit any of the objects properties. I'm unable to even change tabs. Is there a fix?