Is there a way you could pull from sharepoint using VBA? - excel

I have coded a macro that takes data from current document (excel) to another document (Excel) from a specific file folder.
Now the company is moving to share point. Is there a way to do that?
Now my VBA code is in an excel that:
Opening different -file path- excel file.
Copying and pasting data from one excel to other excel.
Can I access share point for the specific file path?
I have tried
‘’’ActiveWorkbook.FollowHyperlink Address= “link” ‘’’
But this will not allow me to continue in the macro since it does not open the excel in the app. Rather it opens the direct internet url hyperlink.

Yes you can access Sharepoint with a specific file path. If you sync the relevant Sharepoint folder, it will appear in your File Explorer and you can copy that file path to use in the VBA code.
https://support.microsoft.com/en-us/office/sync-sharepoint-files-and-folders-87a96948-4dd7-43e4-aca1-53f3e18bea9b

Related

Create PDF bookmarks Within Excel Workbook

I'm attempting to build a monthly process that converts an excel file to a PDF with bookmarks for each respective sheet. I'm not seeing a method to successfully create PDF bookmarks from within the Excel workbook. Can this be accomplished without third-party software?
What I've tried:
Using Header 1 for a cell as well as an entire row.
Putting Excel Book Mark within the file using a hyperlink reference.
Adding named range.
OneDrive flow Convert File
Adding a Header.
Reviewed some VBA Ref libraries hoping to find an object.bookmark type approach.
Unfortunately, all attempts have resulted in a PDF file with no bookmarks.
Is there a method to create PDF Bookmarks from Excel? Possibly a VBA ref library that I am unaware of or some front-end trick? Unfortunately, I'm stuck working only with Microsoft tools. Adobe's Excel Add-On does exactly what I'm trying to achieve.

How can i link two Excel files in SharePoint?

I created two excel files. One as a template to fill and another to store the data from the first, written in VBA Code.
Now I need to upload them to SharePoint so they can be used by everyone. But in the VBA code i need to tell where the WB is.
How can i do it?

Does SharePoint support Excel spreadsheets linked to each other?

I have a master excel sheet on sharepint (called "masterfile.xlsx") that I want to link to another Excel file (called "file-test.xlsx") in different folders on sharepoint.
I need that the "masterfile.xlsx" reflect any changes in the worksheet "file-test.xlsx"
Thanks
Write your formulas in your master workbook to include the URL to the online content. The links will not update when you display the master workbook in the browser (online), but can be updated by opening the master workbook in a desktop Excel.
='https://yourDomain.sharepoint.com/sites/yourSite/Shared Documents/[yourExcelFile.xlsx]Sheet1'!$A$1
You can link them using Excel's PowerQuery:
https://answers.microsoft.com/en-us/msoffice/forum/all/linking-two-excel-worksheets-in-sharepoint-online/cfe2741b-f09b-4d22-93ee-37218261a4d4
You can relink the files using Mapped Drives (mapping a drive letter to a SharePoint library), but this is not a good solution unless all users of the Excel file are willing to map to the library using the same drive letter.

Excel Hyperlinks to Excel documents not working

We have a excel document that contains a ton of Hyperlinks to other Excel Documents & File Paths all located on our network. All of a sudden the Hyperlinks to the Excel Documents have broken, Excel will state the error below;
Some files can contain viruses or otherwise be harmful to your computer. It is important to be certain that this file is from a trustworthy source.
Would you like to open this file? OK/Cancel
We click OK and nothing will happen. Opening file paths is still working fine and I've created another Excel document which has links to a PDF, a File Path, a Word Doc & an Excel Doc. Still only the Excel that isn't working.
I have followed several articles online that suggest how to disable the warning message,below is a well detailed article for 2007/2010 but we had tried to adapt it for 2013/6. Nothing I have tried is working, does anyone on Stack have any suggestions?
https://support.microsoft.com/en-gb/help/925757/how-to-enable-or-disable-hyperlink-warning-messages-in-2007-office-pro
We are using Office 2013/6 Standard/Professional.
Any help would be greatly appreciated!!
Many thanks,
Sean
This happens when you copy the excel file to different location:
You can do test: place hyperlink into 1 cell save it, and then copy the file to another location: you can see that hyperlink of your copied excel file would not work.
However when you choose the same file to "Save As": the hyperlink of the saved file in different location will work.
For excel internal hyperlinks (hyperlinks to other worksheet cells) similar thing happens when you rename the file: hyperlinks won't work, but they will work if you choose to "Save As".
This means, the solution to this problem would be: copy the excel file to it's original location and name it with the original name (when hyperlinks were working). In this case hyperlinks will work. Then if you need to move or rename the file: open the file from original location and select "Save AS" anywhere you would like to save, in this case hyperlinks of your saved file would work.
Conclusion: relative references to the Excel file in hyperlinks are not automatically updated when externally file is moved or renamed.
So we managed to find out what was the cause of this problem.
Microsoft are currently working on fixing this as stated in the article below, but as a quick fix you simply need to remove Windows Update KB4011051.
https://support.office.com/en-gb/article/Hyperlinks-to-another-Excel-workbook-no-longer-work-after-updating-to-the-August-1-2017-update-KB-4011051-dfe0aa5c-a2ba-41b8-923a-fe0e4556f936
Thanks for the assistance,
Sean

Non-portable Excel VBA macro behavior

I'm using Excel 2010 and adding a small VBA macro to a spreadsheet. (The purpose of the macro is to take the data on the active sheet and export it to a CSV file, but that's tangential to the question.) The macro determines the output path for the file using ThisWorkbook.Path. I also added a custom button to the Quick Access Toolbar to activate the macro.
After getting a working algorithm in place in my experimental spreadsheet (Test.xlsm, stored in one path), I made a copy of the spreadsheet in another path and renamed it to _Database.xlsm. Then I opened _Database.xlsm and ran the macro. To my surprise, the file was written to the original path, not the new one. And looking down at the Windows toolbar, I saw that Excel had opened the original file over in its original path as well.
After a lot of jiggering around with code tweaks, checking properties and such I finally found that I could prevent this by opening the copied spreadsheet, removing the Quick Access Toolbar button, re-adding it, and then saving the file. My questions are:
Why isn't the macro "independently portable" along with the spreadsheet? I.e. why does the copy maintain this kind of tie to the original sheet?
Is there a way I can create or modify the macro to make it portable in that sense?
If you want a toolbar/button to travel with a file (ie. not always link back to the original version) then you need to add it to the file itself, not to the QAT. The QAT only "knows" about the actual file you linked the button to.
It might be better to add the macro to your Personal Macro Workbook and then just have it operate on the ActiveWorkbook.
However, if you want to distribute it to other users, you can keep the macro in the "database" workbook and add a custom ribbon part. See: http://www.rondebruin.nl/win/s2/win001.htm

Resources