VBA and MDB database both in SharePoint. How to set connection? - excel

I am fairly new to coding in VBA so finding this quite complex to resolve.
Background: I have a folder hierarchy in SharePoint with each folder having Excel files. I am trying to copy all the data from the Excels file and store in .mdb database. I have mad an Excel file(VBA) which also has a search functionality querying this database.
Current Situation: I was able to sync this SharePoint to my OneDrive and had access to these files in my WE. I setup the VBA code and the .mdb database in the same directory and was able to achieve this task.
Problem: Other who have access to this SharePoint location are not able to use this search functionality because for them the path does not exist.
Is there any way I can make this work? (I tried following a DriveMapper code but htis doesnt work for me either. Error: Network name cannot be found.)
I am really stuck on it and would appreciate some help. Thank you in advance :)

So i got to find the answer for this query after digging for a while.
fPath = Environ("HOMEDRIVE") + Environ("HOMEPATH") + "....". This way the file path can be dynamically updated to reflect each user's homedrive and path. Hope it helps others seeking similar solution.

Related

User option in Access to select unique filepath for Excel source data

I am working off of a great solution created by #MattHall from 2011 to a question that I also shared about importing a dynamic range from Excel into Access.
Specific to that--though in general for future VBA's--my question is whether there is an additional way to be able to point to the Excel source file if it is moved without having to go into the VBA editor every time?
For my specific needs, I am trying to work on these Access and Excel files with others through a shared BOX that has a different file path for whoever is working on it.
USER 1 may be: C:\Users\USER1\Box Sync\filename.xlsx
USER 2 may be: C:\Users\USER2\Box Sync\filename.xlsx
...and so forth for any other users. I am curious how we can all work off this when the file path used in the VBA created and used by USER1 is not accessible by USER2? Could there be some code that allows for the every user to locate the file each time through their own filepath?
It would be a pain to do that but I also do not know a better option as we are not working off a shared server and this is unfortunately limited to Box share at the moment.
EDIT: If anyone could also suggest how to integrate their recommendation into the 'Dynamic Range' code in solution from #MattHall in the linked Stackoverflow, that would particularly helpful to my request.

Batch file for inserting macro's

I am trying to create a batch file as icon on desktop, that would open a specific excel file, create a macro in it and copy code from a specific txt file into it.
The reason i need this, is that the file is located on a server and the ending .xlm cannot be cahanged (should not) so i cannot save it as a macro enabled file (to store a macro in it )
Could annyone with better understanding please explain to me how to create the said code ?
Thanks in advance!
In theory it's possible by using the VBE object (https://msdn.microsoft.com/en-us/library/aa443984%28v=vs.60%29.aspx). But that's not activated by default so you can not ensure that each user is able to do that.
Better find other solutions for that problem. Can you upload .XLSB for example? Or do you have another kind of server available - for example a database server - you can use for storing the file? We use this method here for deploying our updates on AddIns and report templates for example.

Powerpivot change existing connection from excel to text

I'd like to change the connection of existing table in powerpivot. Currently the source is an Excel file on my hard drive, I'd like to change this to a text file.
From the research I've done I've found this blog which describes a solution to changing the type when the connection is a server, however I'm struggling to implement this solution with files that are stored on my pc
Hoping there's a simple answer here
Regards
Ria
Ria, unfortunately, this isn't as of yet supported. When to try to change the type of file in Existing Connections dialogue window, you will get this error:
So the solution is to create a new connection using text file and reproduce all the work you have done. It's super stupid, but there is no other way at the moment unfortunately.

SharePoint 2007/2010 issues copying lists with hidden files using MetaVis

I'm working on migrating SharePoint lists (using MetaVis Migrator) and running into issues with files that seem to end in .000 files extension. Near as I can tell this was sometimes a temp file in SharePoint. (I'm not an SP expert)
Anyway, these files seem to be preventing me from migrating/copying lists using MetaVis. Anyone know if you can get rid of these or where they live?
Thanks,
Jes
These extensions look more like items than documents. Try to copy them using item level copy that will let you to select content type in the destination list. You can contact support#metavistech.com so someone will guide you through the process.
Good luck with you migration,
Mark

Exporting data to existing Excel file

I have a system with an Excel spreadsheet template file which is used for invoicing. I would like the user to be able to click a button on an Xpage, which will then open the spreadsheet and enter the latest invoicing data in Excel. I don't mind if Excel is either the application on their machine or on the server, but my preference would be the application locally on their machine.
I've looked into Xagents, as I feel this is probably the answer. I know they can be used to create Excel but I have not been able to locate any mention of opening an Excel file, and entering data into specific cells.
Is this possible?
EDIT: you can use Apache POI for editing and creating Microsoft Office documents. This is a java project which gives you a handle to office documents and this can be used using java.
A good starting point can be the blog of Christian Guedemann from webgate:
http://guedebyte.wordpress.com/2012/09/17/documents-and-spreadsheets-with-xpages-building-the-kernel-part-ii/
(end of edit)
The only way I KNOW and tried to write data from Notes to Excel is exporting the data to an HTML page and setting the Content Type accordingly (e. g. as described here (there are a lot more resources available for taht):
http://www.dominoguru.com/pages/developer2010_xpagexlsexport.html
I am not sure if this is of help but it seems that this project can help you:
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=ZK%20Spreadsheet%20for%20XPages
As far as I can see this project can load Excel files from XPages - and then it should also be possible to edit the files.
Besides that the only solution I can think of is a Notes Agent that is called from the XPage. This agent can then run in background and do all the excel stuff. After running, the XPage can show a link to the Excel file. Actually this is the solution I would consider to implement - but maybe others step in with better answers here.
You don't want to introduce a dependency on Excel in your application -- wouldn't work with an iPad front-end. Rather have a look at the ZK Spreadsheet, it will fulfill your needs.
However if you have to have Excel, then you need a roundtrip solution: load the Excel from an URL (probably generated by an XAgent (?) and save it back. The saving back part is the tricky one. Normal HTTP doesn't allow that. What you need there is a webDAV capable server. Watch out for a project on OpenNTF soon (just clearing IBM legal) that provides webDAV.
However the ZK Spreadsheet looks much better for your needs.
I have a sample database at the following URL --> http://www.nnsu.com/nnsusite.nsf/%24%24OpenDominoDocument.xsp?documentId=B65507CB2DE15B3286257986005F061D&action=openDocument
Download the APCC.nsf. This will allow you to create/read a new EXCEL spreadsheet and then stream the resulting file to the requesting browser. There is not need to have EXCEL or office installed on the Server.
THe examples create a new workbook, but you can also store a "template" on the server or in a notes document and use it as a starting point and then save it to a document or stream it to the requesting browser.
With Apache POI you can read/write to a spreadsheet using data from the notes document the process is initiated from.

Resources