How to identify Logged in user of sharepoint while opening a macro enabled spreadsheet on sharepoint in open in - excel

I have a spreadsheet (macro enabled ) mounted on a sharepoint for multiple user access in centralized location.
However the macro doesn't get kicked off when opening the excel online,but the workaround for this is to open in excel mode which made the macro execute.
can anyone help me with a code to find the logged in user of sharepoint as soon as the sheet is opened?
I can add that to the code in the workbook open activity.
I tried using the Environ$("Username"),but this is not showing me the value that I am expecting as this shows the username of my laptop than the user logged in on the sharepoint.
Basically no matter what the login of the machine where the sharepoint is used,i would like to get the sharepoint logged in user name which could be a different(like my scenario)?

The logged in user from sharepoint can be captured by printing the last Author of the spreadsheet.
The last author is updated with the last logged in user id no matter whether it is from sharepoint or any app.
msbox(ActiveWorkbook.BuiltinDocumentProperties("Last Author"))
I hope this solution helps everyone who is facing the similar kind of issues.
Happy learning..

Related

Sharepoint Excel attachments suddenly not opening?

I've been working on a process that copies attachments to a couple places. Here's the basic outline:
User adds attachments to Power App
Power App adds those attachments to SharePoint list item
Power App/Automate adds those attachments to Freshdesk ticket
Power Automate copies attachments from SP to send confirmation email to user.
When FreshDesk ticket is closed, Power Automate reads attachments from Freshdesk notes and adds them to 1) an email to the original user and 2) the original SP list item.
Everything seemed to be working fine, but I am suddenly having issues specifically with Excel attachments. I can open them in their original OneDrive location, the emails they're attached to (although the Excel previewer doesn't always want to open), and in the FreshDesk ticket. I cannot open them in SharePoint. I just get an error that "This workbook cannot be opened."
These exact files were working fine before. I've cleared my cache, restarted by computer, and tried a different browser. Nothing will let me open them from my SP list. Help!
Edit: Solved, thanks to the folks on r/sharepoint! It's a Microsoft bug. You can view it in the M365 admin Center under Health. Description below.
SP411415 :
Title: Users can't open recently created Excel files from within SharePoint Online lists
User Impact: Users are encountering an error when attempting to open Excel workbooks from SharePoint Online lists.
More info: Affected users will see the following error:
"The workbook cannot be opened"
Current status: The fix has been submitted and we anticipate that deployment of the fix will start within the next one to three days. We're monitoring its progress to ensure the fix gets deployed and saturates throughout the affected environment.
Scope of impact: Any user hosted on the affected infrastructure will be impacted.
Root cause: A recent service update contains a code error within the previewing function which is causing an exception, resulting in impact.
Next update by: Thursday, August 11, 2022, 4:00 AM (9:00 AM UTC)

Excel VBA To Filecopy from Sharepoint to Network Folder No Longer Working

In my Excel VBA Code, I had a simple command to copy a file from my internal Sharepoint Site to a local network drive.
source_file = "//intranet.gbop.org/CR/PublicFiles/3218.pdf"
dest-File = "I:\AFB Info\3218.pdf"
FileCopy source_file dest_file
Last Week the above worked fine. After I updated my Windows Password, the above now fails with a
Run-time error "75"
Path/File access error
I have a ticket into my help desk but can anyone opine whether it was because of the password reset?
Absolutely because of the password reset, VBA may be using your old credentials, as you have manually entered them into the VBA.
Just scan through the connection code and see if that has a copy pasted version of your Credentials (Also don't do that, unsecure AF if any one gets a copy of your Excel, they have a backdoor to your Sharepoint in your VBA)...
This may help if that is the case
If you are however using the linked version and are still getting the error then Helpdesk will need to update your Sharepoint to match your Microsoft login, which is odd because that should be happening by default which is why I think you maybe stored them in the VBA.

SharePoint 2013 people picker retrieves user's old information

I have imported users from AD and keep syncing them for a while. Today two of users' display names have been changed on AD and SharePoint synced them correctly. Just to be sure, I checked users from User Profile Service App which looks OK. New names are appearing correctly.
Yet when I try to add a list item and select user from people picker, I get old user info. This also happens when I try to insert a list item programmatically.
Tried to delete users from SharePoint, however I still get same old users. Do you have any idea for solving this situation?
Thanks in advance.
I found the solution. There was an another User Profile Service Application which was not used and not properly configured. Weird point is, that malconfigured app was not listed on service applications. I found it by using Get-SPServiceApplication cmdlet and removed it. After removal, did a full synchronization and voila! Now I can get current information.
This is may be because entry in SharePoint's hidden user-list - User Information List.
Browse to this list - http://{SiteCollectionURL}/_catalogs/users/detail.aspx
Check for the display name of the users you have updated. If you see old user name instead of new/updated, delete these users from this list.
After this ask user to login to the same site again.

Reload workbook in SharePoint 2010 Excel Web Access

I am developing a webpage for users to view some Excel workbooks in SharePoint webpage.
The workbook is a kind of report to users and will be updated by admin every week by overwrite the excel file in SharePoint.
I know we can reload the workbook manually by clicking File->Reload Workbook. However, if we take this appoarch, every user needs to click the button on their own which is not what we want!! So I would like to do this automatically.
Is there any method to solve this? Any advice is welcome!!
This post my help you.The approach is adding a javascript code to XLViewer.aspx in order to immediately refresh the connections of the Excel Services viewer on every visit.
https://sharepoint.stackexchange.com/questions/28190/how-to-reload-worksheet-displayed-in-excel-web-access-webpart

Microsoft Excel Notification from Add-on

I am building an add-on for Microsoft Excel. I would like to see a notification popping up displaying name of the company whenever the add-on is added to MS Excel.
I tried using xlcAlert, But it demands user interaction (The user needs to click "OK").
I would like to use some banner, which comes for a second or two and then banishes away.
Please guide for the same.
How about a form which loads when the add-in does, and then unloads after a set interval?

Resources