Upload Excel document to shared folder on Google Drive with Excel VBA? - vba

I have found different scripts for Java, C#, and Access VBA for uploading a file to Google Drive. But the only thing I have found with Excel VBA, is a script saving the file in your local Google Drive folder and then wait for the application to sync it.
Is it possible to somehow upload the Excel file directly to a folder that has been shared with me? If yes, how?

I actually managed to do this.
First, you need to create credentials. Follow this guide: https://updraftplus.com/support/configuring-google-drive-api-access-in-updraftplus/
The credentials should be OAuth Client ID
Application Type: Other
Secondly, I downloaded this Access VBA code found here https://stackoverflow.com/a/34627231/1042624
Afterwards, in the Access document, there will be a settings box. You need to fill in the information about your account and the credentials from step 1 here. Then you can use the upload button, and it will work.
However, if you want to use this in Excel and without the form boxes, then you have to step through the code and find where the settings form boxes´ info are being used. It takes quite a while, and the code is too long to post here. But now you at least have the information on how to do it.
NB: I still did not crack the 2-step verification that I have enabled.

Related

Word macros disappear on transfer

I'm using Word 2019 and have created macros I want to send to other organisations.
However, when I transfer the document (.docm) or the template (.dotm) the recipient doesn't get the macros (although everything else goes across). On the Developer ribbon, there is no entry for the macro itself or the VBA code.
I know I can export the macro to a *.bas file which the recipient can then import but I'd like to do it directly.
There is no problem with transferring Excel macros but I can't get Word to work.
Can anybody help?
This is most likely to have 2 possible reasons:
Did you really choose "Word Macro-Enabled Document" as file format? It could be that you saved a normal "Word Document" with the file extension .docm. Note that the file extension does not defined the file format.
If this happend you have actually a Word document (without macros) but with the wrong file extension .docm. Make sure you choose the correct format not only the correct extension.
You can easily test this:
Save your file as macro enabled file docm.
Close Word completely.
Re-Open your file. If the macro is still there your file format is correct.
If you send your file via email it can be that your recepient does not allow to recieve macro enabled files, and his email server is stripping off the macro from the Word file.
If this is the case, then you cannot do much to prevent this. It is in the responsibility of the recepient. The only way to get through this kind of filter is to pack your file into a password protected zip archive so the email server cannot access the Word file. But not that doing so can violate the recepients policies. Also if the reciepient's company did it right they won't allow password protected zip archives via email because the could tunnel through their email filters.
Best solution in this case it to provide the file via some cloud share (Google Drive, Dropbox, One Drive, what ever, …) and send the recipient a link only.
That is because of your AV blocking macros to be saved in your PC. Macros have been used in the past by threat actors and Microsoft has applied a protection to them.
When you edit a document with macros, word creates a hidden file which is the macro you are running, now when you try to save that file, it gets caught by AV. Since AV thinks it is an evil activity. It gets saved on your system because your directory is now a Trusted Location and it is okay.
A workaround is to install Windows 7 with Microsoft Office 2007 to get what you want since Windows 7 has little to no security.
Thanks

Is there anyway to get the feature data of .sldprt file without opening it in solidworks?

I need to get the features of each .sldprt file as the data of other project. But the truth is I have over 50000 .sldprt files, which takes lots of time to open each in solidworks and traverse its features and close it automatically. And I didn't find any solution in api documentation of solidworks in SOLIDWORKS Document Manager api Help. So is there anyway to get the features and sketches directly without opening the file in solidworks? Such as using the solidworks Document Manager api?
Unfortunately, no. SolidWorks Document manager can not access any feature or sketch information.
There is no way to go around opening each files in SolidWorks.
But there are some options that could speed up the process. See:
https://cadbooster.com/improve-solidworks-macro-speed-10x/

MS Outlook attatchment sync with Sharepoint database

Okay this might be a interesting question but if there is a custom form people use on Outlook to submit files to be posted online, is there anyway (when the send button is pressed) to sync that file to a Sharepoint database (archive) of these file types?
These files are generally reports and we are trying to keep an archive of them without making it a two step process - 1. submit web request 2. then upload to archive.
The short but unhelfpful answer is - yes, you can do that. There are several APIs available for integrating with SharePoint that provide the ability to upload files. You can build this functionality in an Outlook COM Add-in. However, a lot more specifics are required for a more detailed answer.

How to password-protect a VbaProjectPart using OpenXml SDK

I have a scenario where users download their Word document from our local server and when they save that document, instead of saving it locally, the document is sent back to the server using a macro (which is "injected" by the server every time a user downloads a document that doesn't contains the latest version of the macro).
Now that we are going to send this solution to our final tests prior deploying it, we needed to protect that macro, I know I can password protect a macro using Microsoft Office by simply right clicking in the macro project inside the document and selecting "block from viewing" and inserting a password.
However, since the macro must be handled by the server, I need to find a way to protect that macro when I generate it, currently the macro is generated using OpenXml SDK using a VbaProjectPart. I couldn't find anything on the web.
Instead of trying to sign and protect the macro programmatically using Open Xml SDK I decided to download the document, sign it and protect it using word then I used "Open Xml SDK Productivity Tools" to "reverse engineer" the DOCM created and then I copied the binary "VbaProjectPart" created by the tool.
It's not the best way to do it since I need to have a separate documentation for this process and need to do the whole process when the macro changes, however, since the code isn't expected to change anymore I decided to go that way.
Hope this helps anyone who wants to know how to include password protected macros inside an Open Xml document.

How to read changes in excel file into vb.net application

I have an excel file which is auto generated by third party software..and its readonly file and its data constantly keep changing online.
now i want to use or read that data in my vb.net application whenever its changes take place in excel file automatically.
please help me..
Cody's right. No question, but I'm guessing you're looking to do something along these lines.
First, you'll need to pull down a copy of that XLS file (sounds like it's online at a website somewhere). To do that, you'll need to perform a pretty normal HTTP get or use whatever API the website provides to pull the file down.
Save the file locally, then open it and read it using EXCEL AUTOMATION. Just google excel automation for loads of examples of opening a worksheet file, reading cell values, and closing the file.
There's other options too such as the OpenXML api from Microsoft to allow you to read the contents of XLSX files directly without using excel automation, so that may be a possibility. not enough in the original post to know which would work best for you.