VBA IE 10 Automation - Automatically Save PDFs - vba

I'm trying to automate the process of saving PDF invoices for bookkeeping purposes. The method suggested here does not work because a login is required to access the invoices.
I currently have a macro that navigates to the page, logs in and opens the links to each invoice. The URL scheme for these invoices is .../account/invoice/?invoice_number=XXXXXX. Navigating to each of these URL brings up the files in the
window. I would like the files to automatically save, but according to this page, the Always ask before opening this type of file option was depreciated from IE 10 and 11 due to security reasons.
I attempted to automatically click Save using this method, but the code here seems to be for a different version of IE.
The line:
hWnd = FindWindow("#32770", "File Download")
was modified to:
hwnd = FindWindow("#32770", "View Downloads - Windows Internet Explorer")
This successfully captures the download window, but it fails to find the &Save button for me to click. My guess would be that it's because there are multiple save buttons.
Any ideas would be greatly appreciated! Thanks.

Related

MS Access Form with Webbrowser Control Popup New IE Window, Access 2010/VBA

I have struck with one issue not finding any workable solution. Googled a lot without any success…HELP PLEASE.
Situation: Using MS Access 2010, there is one Form with WebBrowser Control (Unbound) for conducting some search, when I click the results of the search a Pop-up new Internet Explorer window opens for the search result.
Requirement: I need “new Internet Explorer window” needs to be opened on existing WebBrowser Control..... NOT to open separately as new pop-up Internet Explorer window.
Kindly provide me solution (MS Access 2010/VBA) or workaround….
Regards,
Sandy
Can you open the form that you are opening in the WebBrowser Control in a new browser window outside of the application in order to test something. Check to see, if when you open the url, and then invoke the search, if the results open in a new window for that browser. If so, then check the target of the form within the first screen to get the name of the window that the page is trying to open the results in. If the target is specified, then you will need to write code to remove it when the page loads.
Just assign the new web address to your webbrowser control. something like this. Note it has to include equal sign and a hyper-link surrounded by quote.
Private Sub WebBrowser34_Click()
Me.WebBrowser34.ControlSource = "='www.google.co.uk'"
End Sub

Excel VBA to change internet explorer advanced settings

My current program that I am using, from excel, navigates to a web page where it downloads a lot of information. I primarily do this from excel because the data is in excel format.
I have it go to the page, click on a link and the open/save/cancel dialog box appears it automatically selects save and saves it to the last folder I saved anything in. Then it waits for the dialog box title to read "download complete" then close it and initiates the next download.
The issue I'm running in to, is that other people who use this program have the "close dialog box when download completes" option selected, and this interrupts the overall process.
Is there a way to change this setting from the excel VBA code, or will I need to explore a different method of dealing with this issue? Having the program do a direct download URL string is also not viable as the website needs to be logged in to and the request must come from the open window, (I have already attempted that method).
Use URLDownloadToFile to download from the internet, trying to use IE will lead to other issues:
VBA - URLDownloadToFile - Data missing in downloaded file

How do I handle the closing event of a windows explorer window using VB.NET

I'm working on an application where I have a list of hidden directories in a treeview. When the user double clicks on a folder in the directory structure, I open up that folder using the code:
Process.Start(tvHiddenFolderListing.SelectedNode.FullPath)
Now, the the files within the folders are hidden as well so when it opens the folder, you cannot see the files (Provided view hidden files and folders is not selected.). What I want to do is:
1) when the folder in the tree view is double clicked, I will un hide the files, then open the folder using the process.start code so users will be able to see the files.
2)When the explorer window that opens up upon double clicking is closed, I want to hide the files again. This is where my query lies.
I figured I have the following options:
1) Handle the onClose event for this explorer window and add the code to hide the folders and files within this event.
2) Create a new form in my project an open the path in the process.start above, in this form. In other words, make my own windows explorer form so I can handle the onClose event of this form accordingly.
3) I know how to get the process ID for the explorer window when I start it using process.start. I could check when the process is killed, or exited and hide the folders then.
In a nutshell, I want users to double click the folder in the tree structure, open up that location in a windows explorer and browse it as they normally would browse any other folder on their computer, but I want to have the ability to specify what happens when that window is closed, i.e. hide the files again.
I would greatly appreciate any assistance on achieving my goal via any of the above mentioned methods or an alternative that you think would be better suited.
Thanks in advance.

Form won't open in Sharepoint Designer 2010

I'm using Sharepoint Designer (2010) to develop a series of connected lists.
I have a number of child-lists and I use the "DispForm.aspx" of my main list to add these 'children'.
Recently the DispForm.aspx has stopped opening in Sharepoint Designer. Clicking it from the list's main page goes into the Form view, but the page never loads and I get no error messages.
Since I can't see the Code window I can't make any changes, even though the page works fine in the browser and I can perform (limited) edits directly on the website through Sharepoint.
Has anyone got any tips on what I could try, or any way of accesing the code in DispForm.aspx if I can't open it in Sharepoint Designer?
Not a fix as such, but I got around this by mapping a drive to the sharepoint site and using notepad++ to edit the file directly.
If you browse the lists folder and the list you are interested in you will see the display, new, edit forms in there
S

C# webbrowser control: page opens new window but it won't work

I use a webbrowser control (in C# - latest version of visual studio and .NET) to allow me to read and write data to a specific web page. Everything is OK until I reach the point that the page attempts to open a pdf document in a new window (the page contains javascript code).
The new window opens OK on my IE. But nothing appears when the webbrowser control opens the new window...
I've tried setting firefox as my default browser to see if it makes any difference but no good came out of it. The webbrowser control still opened IE.
I've tried catching the event of the new window and refer the url to another webbrowser control... no success again!
How can I get the pdf document? And why would the new window open but not display the pdf?