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

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.

Related

Advice on how to connect to an MDB database on SharePoint from Excel VBA

Several years ago, I coded from scratch a complex Excel-based system for my organisation, which used an Access-compatible database as a back-end. This was in response to the broken Excel "shared spreadsheet" functionality, which would frequently crash and cause data corruption or loss.
The working system was (and still is) stored on our shared network drive.
It has now been decided that the shared network drive will be decommissioned, and all shared files will be on SharePoint. For the most part, this works well, and all other files have successfully been transferred. However I have not yet managed to find a way to make my system (Excel front end and Access back end) work with it.
When I try to run:
Dim LocalCnn As New ADODB.Connection
With LocalCnn
.Provider = CheckProvider(strPath:=DBPath)
Select Case Mode
Case "RW"
.Mode = adModeReadWrite
Case "RO"
.Mode = adModeRead
End Select
.Open ConnStr ' ERROR LINE
End With
.. then I get an error
ConnStr evaluates to:
Data Source=https://myorganisation.sharepoint.com/sites/proc2126/Shared Documents/Archive/Test.xlsmDB_ADMIN.mdb;Jet OLEDB:Database Password=mypassword
It is possibly something to do with the space in the file path? This is not something I can do anything about, as the highest directory I have access to is "Shared Documents" (with the space). The exact error message I get is:
Run-time error '-2147467259 (80004005)':
Automation error
Unspecified error
I have tried to Google the problem, connecting to a database file using VBA on SharePoint, but it seems to be inconclusive whether it's possible.
To clarify: this needs to work 100% within SharePoint, without having to download files to the local drive first.
Grateful for any advice you can provide!
NOTE: I am NOT using the MS Access program at all. This question has been tagged with ms-access because the mdb files are Access-compatible, that's all. I'm using an Excel front end, but using VBA to directly connect to the database files, bypassing the Access software entirely.
Tough luck! Access is only supported on local drives or SMB shares with leasing disabled, and previous options to run Access on SharePoint have been removed (since 2010 afaik).
You can directly migrate the data from Access to SharePoint lists (Database tools -> Move data -> SharePoint), and then use the undocumented WSS option of the ACE OLEDB provider to connect to SharePoint lists directly. See connectionstrings.com on the ACE OLEDB provider at the very bottom.
I highly recommend not doing this, and either get your organization to get a decent RDBMS that can be used as a backend (best) or get them to not fully remove the SMB share. Migrating an application to SharePoint lists will come with substantial slowdowns, limitations in what queries can run, and general misery, even though it can sort-of work (speaking from experience, unfortunately).

Excel VBA Userform won't work on all computers

I have made a user's form using VBA excel code. Its working fine on my laptop however when I tried it on my office computer it doesn't work. I emailed the file to myself and downloaded it from Outlook in the office. Its a .xlsm file. It gives me an error message that macros have been disabled. I have already changed settings to enable macros and allow VBA projects. I reopened excel and checked again it still doesn't work. The downloaded file from outlook, when I click visual basic, it doesn't show me any user form or code at all. Not sure why.
My whole code is present in the user form part (file in a personal laptop). There is a button on "sheet 3" which basically opens the user form. Not sure if it's saving the code only locally on my computer. As per my understanding if it's saved in the file it should be a part of it even if its opened on any other computer. My laptop version is office 365 and office one is 2016. I am not an advanced user. Kindly advise what is the error out here.

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

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..

Unable to open Excel document after deleting Mac OSX Keychain

I deleted my Mac OSX (El Capitan) Keychain. Everything except the certificates. Now, when I go to open an Excel .xlsx doc Excel reports:
"Can't open This_File.xlsx. This workbook is either deleted or not currently accessible."
I've verified that the file is present via Terminal. If anyone can help figure out how to open this file I would certainly appreciate it.
Thanks!
Since I deleted my keychain all of my Microsoft Office credentials that were tied to my work domain were also deleted, hence, I did not notice that I wasn't "signed in" to Excel (2016). Once I signed in to Excel, which then redirected me to a domain authentication page, Excel still did not let me open my workbook from the "recent documents" GUI. I had to open terminal and execute:
open /path/to/my/excel_workbook.xlsx
And then it opened. I hope this might help someone else in the future.

Workbook protection causing "External table is not in the expected format" in SSIS

I have an SSIS package that is supposed to load files from excel into SQL Server.
Process goes smoothly when excel workbook is not password protected. But when I password protects this workbook, I starts getting error External table is not in the expected format. Any solution that can be done within SSIS to enable SSIS to read this.
The almighty internet search engines suggest it cannot be done:
http://msdn.microsoft.com/en-us/library/ms139836.aspx
Note
You cannot connect to a password-protected Excel file.
However you could create a little tool in another language (powershell is suggested) that will be able to open the excels for you with the passwords (that you have to provide this tool) and save a version of the workbook without password for your SSIS to use.
Alternatively: Dont password protect the excels you use for your SSIS. For protection you might consider setting up a location with limited/restricted/no access for all users but the one that will run the SSIS.

Resources