How To Use VBA To Share Excel File With Fellow Office User? - excel

How does one use vba to share an excel file with another office user? I have a template that needs to be customized slightly and shared as a separate workbook with hundreds of users (same active directory).
I have a table mapping out what files should be shared with what users as shown here:
I thought I could use a sharing method to set the permissions using MSOPermission. I've tried quite a few approaches which have all failed, but these were the ones I was most optimistic would work:
wkBk.Permission.Add "bill_User#company.com",msoPermissionEdit
wkBk.Permission.Add "SallyCEO#company.com",msoPermissionRead
wkBk.Permission.Add "billy_companyID",msoPermissionEdit
The specific error I receive (shown here) indicates something is wrong with the Permission Object. I can't find much documentation on this (a common pet-peeve of mine with Microsoft).
I've seen a couple posts shown below, but none address my question.
Automate File sharing
Share and unshare file
Permission sharing
I'm sure I'm in the wrong area or maybe I need to enable a library. I'm embarrassed to say that I even attempted to use the macro recorder, but no code was logged when I interacted with the sharing menu shown here.
Bonus Question
It's possible that VBA is not the best tool for handling my use-case situation. If there's a better automation method for my situation such as TypeScript or Power Apps, I will upvote any suggestions that include basic instructions or a reference with specific terms/procedures that I could use to hunt down an overall solution. Thanks.
Note to Microsoft: Executing this comparable task in Google Sheets is easy and well documented:
ss.addEditor("billyTheUser#gmail.com");
ss.addViewer("sallyCEO#gmail.com");

PowerApps was mentioned - assuming you have a standard O365 license and SharePoint Online available then it's possible to set access as needed here's an illustration from an SPO Documents library file:
Microsoft Documentation:
https://support.microsoft.com/en-us/office/customize-permissions-for-a-sharepoint-list-or-library-02d770f3-59eb-4910-a608-5f84cc297782
Option 4 from this article:
https://sharepointmaven.com/6-locations-can-set-security-files-sharepoint-office-365/

Related

Excel Mobile Data Entry Form

I am trying to create a data entry "app" to collect daily readings across our site. Here are the three biggest constraints:
Software - ideally, we would use some software within the Microsoft 365 Suite, mainly because those are the only approved apps on site. It may be possible to use open source software, but that might raise some flags in terms of security. So my thoughts are to use either Excel or Access.
Cost - ideally, we do not want purchase any additional software licenses. I would try and create something with Power Apps, but we do not have the licensing for an Azure or SQL server to store the data. I could be missing something here though.
Mobile-Friendly - finally, it needs to work on an Android tablet. Currently, we collect readings using pen and paper. The whole idea of this is to move towards using a tablet.
The easiest approach would be to create an Excel spreadsheet, save it on OneDrive, and edit the spreadsheet. I don't love this option because we are collecting 100's of data points each day. This would end up with a very wide spreadsheet that will be cumbersome to navigate.
The other option I looked into was creating an Access database and accompanying form and storing it on SharePoint. However, it seems Microsoft has stopped supporting Access databases on SharePoint.
I have created data entry forms using VBA, similar to this, but these do not work on mobile.
Is it possible to create a data entry form in Excel that also works on the Android version of Excel? Are there other alternatives I am not thinking of?
I am engaged in just this kind of project also. I have written an app in PowerApps, built an Excel spreadsheet and stored it in OneDrive, and am running it (the app) on an iPad. The design differs somewhat from your description of directly presenting a spreadsheet to the user (which I think PowerApps could do) because I don't want users having direct access to the data.
Edit: You do not need Azure or SQL, unless you are storing tons of data. Excel can be a satisfactory data storage location for modest uses.
I found the learning curve for PowerApps to be quite steep, as it's a different paradigm than line-by-line coding.
I think this is a more user friendly way to collect data than trying to run an Excel form, and once you get it made and polished, you'll look like a pro :)
I am by no means an expert but if you need some tips I'll do what I can to help. It sounds like we are at similar developmental stages.
Is it possible to create a data entry form in Excel that also works on the Android version of Excel? Are there other alternatives I am not thinking of?
Microsoft Forms does the job when created from OneDrive on mobile browser. Side note: the form I just created and the response I submitted have now disappeared from my OneDrive.
I also saw some people using Power Automate to save responses from a form into an Excel file (every reponse).

Sharepoint alternate ideas to get report from multiple user

We've a real pain in our project where we ask a team of 50 resources to update a single excel sheet that's placed in a network location and when someone tries to update the data, it's locked by somebody else and they don't update it. So, they end up not updating the data.
I'm looking for an alternate solution like
creating a form in sharepoint/ jira - no sharepoint/ jira developer
getting data in mail - too tedious and lots of rework
creating a custom form and hosting it in local server - might work - any templates on this?
Or, any alternates? I'm out of ideas.
easiest thing would be to create a simple SharePoint-List. All Users can update their data at the same time and the Input-Form will be there automatically. (Can also be exported to Excel)
If you are on SharePoint-Online you could also have a look at Windows Form which provide more flexibility in creating the form.
And if you need even more capabilities you can have a look at PowerApps

Best way for shared online sheet like web surface

I haven't found a good and simple solution to my problem:
I need either online shared excel file with password protected access or a shared online form like excel adding names+rows+person related data.It has to be lockable on a specific date.
Google Sheets is too open and general. I have to be the admin and be able to lock the Sheet, if the deadline is past and the content in the forms should match.
Also, A simple doodle ak is not a desirable solution. Does Anyone know a product which provides such service? Or Do I have to write a quick web interface?
how about MS Sharepoint? we can use it for spreadsheet sharing, access control, online check in, edit and then check out, etc.

SharePoint site space usage

I would like to find out how much space my group's SharePoint site uses (files + version history). However, I only have administrative access to my site, not the entire SharePoint instance, so I have to come up with my own solution. I'm interested in the total, but usage per individual file is also fine.
I've googled everything I could think of but couldn't find much that would help. SharePoint programming seems out of the question since I don't have access to the machine. SharePoint Web Services looked promising but none of the services provided seem to give me what I need. I also found a VBA library that lets me list the versions of a document: Office.DocumentLibraryVersion. However, this type does not include a "size" property - why not?
Anyway, I would be happy with either of the following solutions:
A library or API to be used from VBA, VB, or C# (or any other language, for that matter)
A SharePoint Web Service that provides file size/space usage information
A completely crazy script that uses http to iterate through all the folders/files/versions in the library and does insane pattern matching to figure out the size of each file, then adds them together and returns the grand total (SharePoint du)
I figured SO is the best forum for this question, but a non-programmatic solution is just as welcome. Basically, anything you can come up with would help. At this point, even "this is not possible" would be useful.
Thanks in advance.
There is a hidden page that does this... Cannot find it right now.
Check the 1033 directory and similar to /layouts/usage.aspx.
That page links to /layouts/storman.aspx. Unfortunately that page does not work if your site collection does not have a quota.
Go to Site Settings / Site Usage Report.
If what you are looking for is not there, I don't think you can do it with your level of access.
got to siote actions--> site administration-->site usage reports-->
you can get the site usgae report
if you want to get it in excel chart--> open your site in sharepoint designer-->site-->reports-->usage-->then you can get
usage summary
monthly summary
daily summary
daily page hits
etc

Permissions problems with Excel Services in SharePoint

I'm trying to implement an Excel Services reporting solution in SharePoint (MOSS). Since the source data is a SharePoint list, this problem is doubly frustrating. I keep bumping up against permissions problems, even though I've enabled virtually everything in sight.
The first error is about refreshing external data - it's not (really) external data, but that's a semantic point.
The second error is a cryptic "Excel Web Access" problem.
Anyone get this to work??
Could be a couple different problems. The first possibility is that Excel Services doesn't support using SharePoint list data (crazy I know)... although this only applies if you try using the type of embedded data source you get if you choose Export to Excel from a list (again, I know crazy).
However an easy way around this problem is to use the SP webservices to get you list data. I had a macro written by someone at MS a while back that automated this conversion, if I canfind a link I'll post it. If you are using Kerberos then you task is probably finished. If using NTLM then you may need to also configure an SSO application so that the right credentials can be passed to the webservice (or any other data source for that matter). There's a pretty good step by step here.
One kind of "hack" to get this to work via UDF's (which if trusted, custom code can be deployed and made available via Excel Services) can be found here.

Resources