Simulate drag & drop file to website in VBA - vba

I have an Access database that uses VBA code to generate a GPX map file. That works fine. I then want the contents of the GPX file to be displayed on a website, https://mapy.cz
The method that the site authors intend is for users to open the site, then manually drag and drop GPX files onto the site, at which point the contents are read in and displayed by the website. This also works fine.
What I want to do is NOT require my database user to open a browser, locate the file and drag it onto the browser by hand. I want my VBA code to not only create this GPX file, but also open the user's default browser, direct it to this mapping site (all this also works okay), but then SIMULATE or FORCE the drag and drop action FROM MY VBA CODE. That is the part that on which I'm floundering. I've looked up things like using VBA's IE.Document object, and it seems to me that it should be in there somewhere, but I can't find anything that makes sense to me.
I've done similar things in the past, with SendKeys to simulate the user typing, and AutoIT to code-control a running DOS application, including reading the programs responses from the DOS screen and forcing in commands, all from VBA. It seems to me that this should be possible, and not even all that uncommon a requirement, but I've not located anything helpful in all my searching, and I've done a lot. Maybe I'm simply phrasing my searches wrong, but at this point, I'm just flat stuck.

Related

VBA options to scrape contents from currently loaded webpage in edge (or IE), or Excel directly?

Background: Many years ago, I used Excel VBA to scrape some dynamic web pages; I had to scrape it from IE after it was loaded (the page wasn't directly accessible from Excel without a lot of sendkeys & password hassles). I find myself in a similar situation and am wondering if MS tools have progressed in recent years to provide an easier way.
Situation: I'm not a UI person, haven't looked at the page code yet to untangle anything; I have a dynamic, visual org chart where each person has a box/tile (image, title, name, etc) and the whole chart changes depending on who is selected. The page is served from a passworded SAAS, so I'm not excited about trying to access the site directly with Excel - I think the right answer is still to scrape what is already loaded in the browser.
The core problem is formatting - I need to be able to move the boxes around (closer together, and change the layout a little) so it fits better on powerpoint slides.
Since it has been a while since the last time I did this, I'm just posting to see what I should know before starting: am I stuck with IE, or does Edge allow other programs to access the loaded pages via VBA? Do any of the 'data source' options in Excel do a good job of parsing visual page content in a way that would make it easier to scrape? Is there a completely different method I should learn?
Thank you in advance for any advice!

webbrowser control shows a save as dialog instead of displaying a local .mhtml page

This one has me scratching my head.
We have a "Previewer" which hosts a WebBrowser control.
When this "Previewer" is used to "preview" a Word document or Excel Spreadsheet I use some code to convert the document to a .mhtml file. I then tell the WebBrowser to navigate to that.
This works fine on many machines but not all. On some machines, instead of "navigating" to the mhtml and displaying it in the WebBrowser control, the WebBrowser control takes it upon itself to present a "Save As" dialog, asking the user to save the .mhtml file to their PC.
What is going on here, and how do I stop it?
Thanks
An example of the sort of file I try to navigate to:
"file://127.0.0.1/C$/Users/blahblahblahhere/AppData/Local/furthersubfoldershere/637183327673490444_Document1_486951.mhtml"
All I'm doing is
oWB.Navigate(....)
Ok.... this may also be relevant. This happens when a user is using an add-in we wrote in Outlook 365.... So the WebBrowser control is hosted in our Add-in in one of the forms it pops up as the user is doing their thing in Outlook.
Well, I still don't know why it does this for an .mhtml file, but I found that converting it to .html instead actually works. I was reluctant to do that as a Word Document or an Excel Spreadsheet converted to HTML might produce an .HTML file with lots of associated files, e.g. for images. But while it does indeed do that, as it turns out it still works quite happily in the WebBrowser control. And without popping up that "save" dialog.
If you must use MHTML I have no solution for you, but if HTML is "good enough" for you, well, that's how I fixed it for myself.

Download Excel file from URL

Background
I am attempting to automate the downloading of an Excel file given a URL. I know how to do this, and realize there are many examples for how to do this using either the webbrowser or webclient control however my situation is somewhat different.
Problem
If I simply paste the URL into a normal browser, it will result in asking me to save / open the file like normal. When using the same URL with either the web browser or web client controls, it results in no file. I believe this is because the URL is simply a SharePoint link, that sends a request to get the file, but is not the actual file itself.
This can be done for security reasons or whatever the case is but I was wondering if anyone has ever found a way around this?
Perhaps a way to even just emulate the browser, then emulate clicking save?
The URL for the Excel file does NOT end in .xlsx, it ends in something like:
webclient/zhZZXYRyAaLUgD?TC_file=redirs/viewdataset
which is why I think the server simply processes the request and then provides the browser the file.
I am attempting to do this in VB.NET but VBA or VB answers seem like they should work as well.
Fiddler Results
I seemed to find an easy way to solve my problem. After downloading my file within Internet Explorer, and then viewing my recent downloads, IE has an option if you right click and select "Copy Download Link". This puts the true download URL in the clipboard and actually works using the My.computer.downloadfile method.

Creating a Record Option on a PDF or Word Document

I am going to preface this with the question on a more general scale then go on to explain my specific issue.
Is there a way to create a word document, pdf, or anything comparable that I could add a "Record Audio" button to that would save the audio with the file as well as all the other info that might on a pdf/word form?
I know that Adobe Pro has a leave audio comment option, but I am creating this for a user and I do not want them to have to use that. The reason I need this is that I currently have a form usually gets partially filled out and then passed on with a dictation that needs to be transcribed at a later time. I am aiming to do this so that I can have the form and audio file linked and saved under one file.
If there is a way to leave the audio comment on a pdf with some javascript that is triggered by a button, I am perfectly okay with that I just have no clue how to program that (in terms of syntax, I am comfortable programming that isn't the problem lol).
I am also open to forms of documents other than pdf or word. I only mentioned these as they are the industry standard, but if there is another file type that would work around this, I am more than glad to use it!
I am using word 2013 by the way.
Thanks in advance!
You could write a TaskPane Addin that shows the audio controls. Once the recording is complete, the audio could be saved in the CustomXML parts in the document.
Then other users who receive the document and have your AddIn, will be able to listen to the recording.
I have not verified it in-depth, but it would be possible to add a button to the PDF file which creates a Sound annotation. The user should be then automatically asked (via a dialog) to record it.

Edge Animate Automation

Most Adobe products have the ability to be automated using AppleScript or ExtendScript/JavaScript but I don't seem to see the same capabilities in Edge Animate. Maybe I'm just missing something. I'm looking to be able to do things like open the document, add images, save the document, etc. Has anyone been able to find anything like this? I've done a number of different searches to no avail.
I'm not exactly sure what you're asking, but I think you're talking about adding your own javascript, which can be done by clicking the curly brackets located next to any of the elements in the animation, or hittin ctrl+E to see the full code.
Second, in terms of opening the document, you should be able to just double click the an file that it creates, and saving the document is just like in any other program, file>save(as).
Adding images is as simple as file>Import (hotkey = ctrl + I).
not exactly what I was asking for, but I did end up finding a solution. I was looking for a mechanism to be able to control Edge Animate similar to how you can control InDesign, Photoshop, and Flash via VBScript, and JavaScript respectively. This allows you to do things like import images into your document from an external script, save the document, export contents, etc. In the end, I wrote some code that sends key-strokes to the application and that resolved the problem although not ideally, IMHO. Thanks for your responses, though.