I want to write SubRoutine in Excel to make IE a default browser using VBA.
I have to run .bat file that will open Intranet url with random token parameter (from .bat file) with default browser. Some users may have Chrome as default browser but I want them to temporarily change to IE as my another SubRoutine require IE as a browser. I can change it back to chrome using VBA code.
I know that I can use shell to open IE with specified URL (even Chrome is set as default browser), but, as you may see, it will not solve my problem.
I expect to see code look like this
Set Shell = CreateObject("wscript.shell")
Shell.Run ("iexplore.exe --make-default-browser")
Related
I'm trying to open a Google Chrome window, and continue to use that window to do many things. Which means I need to set it to a variable. Is there anyway to do this?
I have the following code to open the Google Chrome window and navigate to a URL, but I need to do more than that.
Sub Test()
Shell ("C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe -url https://google.ca")
End Sub
I want to type in my username and password, hit the submit button to log in, and do other things. Is there a way I can reference the chrome window like I could in Internet Explorer? (by using Set IE = ...)
Let us know exactly what you are trying to do in google chrome from excel.
If you are trying to send key commands you can try to use:
Shell ("C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe -url https://google.ca")
Application.Wait Now + 0.00003
Application.SendKeys "{Tab}", True
etc. etc. etc.
Hope this helps!
I know this is a quite delicate question since Chrome for some reason always want to download a file before viewing it.
Is it correct that Chrome cant 'only open' a file? How to work around that? It wont help me to use the "always open this file.." (i think) because the real problem I have is when Im done with the file i want to save/submit back to the instance on the server and that information is gone..
So an exemple..
Im in an SharePoint (native) enviroment and click a (excel-)report from a list I want to do some kind of change in. The file opens as supposed to whatever browser Im on. But when Im done with my changes I want to save/submit the form/report back to the server..! If im on IE or Edge Ill just press save and Excel knows where to send my stuff. If im on Chrome, then Excel tries to save the file to my 'downloads' and I get a error message saying that the submit was unsuccessful.
What to do? Any suggestions?
I would like to insert code to launch a default browser in a new SMALL window from within my Excel spreadsheet. Has anyone done this before?
I can already launch my default browser using a SHELL and/or FollowHyperLink statement but I need my Excel spreadsheet to remain in focus. If possible I'd like to add it to my existing browser call:
ThisWorkbook.FollowHyperLink("h.......")
You can use a WebBrowser control. This may need to be added to the ActiveX controls. Go to Developer Tab > Insert > More Controls > Microsoft Web Browser.
To control the WebBrowser, use the .Navigate2 (string) command
strWebsite = "www.google.com"
Sheet1.WebBrowser1.Navigate2 (strWebsite)
I am using a command line script to open a particular web page in Chrome and send keypresses to that web page
When Google Chrome opens for the 1st time chrome opens up its own Tab e.g. welcome to chrome/login to chrome and this throws everything off.
I dont want any new tabs generated I want only the web page I asked for
Is there a command line switch or method to force chrome to not generate its own tabs. Perhaps registry entry etc?
I have tried some but no success so far
Thanks
Confuseis
Since your question contains the AutoIt tag, I have to assume you want an AutoIt solution.
The best way to do this would be to use chromes --new-window command line switch. This opens a new instance of Chrome, with a single tab pointing to the URL provided, by executing the chrome executable via ShellExecute.
$sPath = #HomeDrive & "\Program Files (x86)\Google\Chrome\Application"
ShellExecute($sPath & '\chrome.exe', '--new-window "https://www.google.com/"', $sPath, "", #SW_MINIMIZE)
I've observed that under certain circumstances, a web browser will navigate to a blank page and then prompt the user to download a file. In my current situation, it's navigating to a URL that generates an Excel file. The download of the file works perfectly, but the user is now stranded on a blank page. There are two things I would like to figure out:
What causes the blank page to be displayed? It doesn't happen all the time. Is it the difference between using GET and POST (I can't recall seeing a hyperlink do it, but forms usually do)? Is it something to do with the Content-Disposition? In my current case, I've set the Content-Disposition to be "inline" because I want it to display in the browser in IE. Firefox (and presumably others) will of course prompt to download because they can't display it inline. It is the situation where the user chooses to save it that the blank screen results.
If it is possible, I'd like to display some content on this blank screen to provide the user with a message like "your file has been generated, click here to go back to the main screen" or somesuch. Is there a way I can do that?
I'm using an IIS extension written in C++, so solutions for ASP, PHP, etc will not be helpful unless they're generally applicable (though I wouldn't mind learning about solutions in those languages!). Thanks.
I think you practically answered your own question: setting content-disposition to inline does exactly that. One solution that comes to mind is browser detection: use inline disposition if the browser is IE, attachment otherwise.
BTW, as a user, I prefer sites which offer me a choice whether I want to download the file or view it inside the browser (when, for example, accessing a PDF file). In this case, I would consider having a link/button for downloading the file, and adding a second link/button for IE browsers to view it.