haserfindyour.blogg.se

Vba open windows explorer
Vba open windows explorer









vba open windows explorer

Private Const SE_ERR_FNF = 2 'The specified file was not found. Private Const SE_ERR_DLLNOTFOUND = 32 'The specified DLL was not found. Private Const SE_ERR_DDETIMEOUT = 28 'The DDE transaction could not be completed because the request timed out.

vba open windows explorer

Private Const SE_ERR_DDEFAIL = 29 'The DDE transaction failed. Private Const SE_ERR_DDEBUSY = 30 'The DDE transaction could not be completed because other DDE transactions were being processed. Private Const SE_ERR_ASSOCINCOMPLETE = 27 'The file name association is incomplete or invalid.

vba open windows explorer

Private Const SE_ERR_ACCESSDENIED = 5 'The operating system denied access to the specified file. Private Const ERROR_BAD_FORMAT = 11 'The. Private Const ERROR_PATH_NOT_FOUND = 3 'The specified path was not found. Private Const ERROR_FILE_NOT_FOUND = 2 'The specified file was not found. '0 'The operating system is out of memory or resources. Public Declare Function ShellExecute Lib "shell32.dll" _ MsgBox "Path not found" Case ERROR_BAD_FORMAT MsgBox "File not found" Case ERROR_PATH_NOT_FOUND LRetVal = ShellExecute(0, "open", "shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge", sURL, "", SW_SHOWNORMAL)Ĭase Is > SE_ERR_DLLNOTFOUND 'If the function succeeds, it returns a value greater than 32 'Success Case ERROR_FILE_NOT_FOUND 'OpenURL6 "" 'OpenURL6 "C:\Users\Microsoft\Documents\Test.pdf" 'OpenURL6 "C:\Users\Microsoft\Documents\Image.jpg" 'Opens using Microsoft Edge Browser Public Sub OpenURL6( ByVal sURL As String)ĭim lRetVal As Long ' lRetVal = ShellExecute(0, "open", sURL) 'action can be: edit, explore, find, open, print, runas Private Const SE_ERR_SHARE = 26 'A sharing violation occurred. Private Const SE_ERR_PNF = 3 'The specified path was not found. Private Const SE_ERR_OOM = 8 'There was not enough memory to complete the operation. This error will also be ' returned if you attempt to print a file that is not printable. Private Const SE_ERR_NOASSOC = 31 'There is no application associated with the given file name extension. 'ShellExecute Return Codes '0 'The operating system is out of memory or resources. ) As Long 'ShellExecute nShowCmd values Public Const SW_HIDE = 0 ' Public Declare Function ShellExecute Lib "shell32.dll" _ The easiest approach to opening a URL in Microsoft Edge is to simply use the Shell function as shown below. Regardless, I did find 2 approaches that did work that I thought I’d share with those of you that need to perform such automation. IMHO, Microsoft has, yet again, missed the mark on this one.Īlso, documentation is basically non-existent on the subject, or at the very least buried somewhere that isn’t easy to discover! All in all, a very disappointing experience. Even with the exe known, standard chromium command line switches failed to work.

#VBA OPEN WINDOWS EXPLORER CODE#

I was unable to use my standard code to locate the exe on a system to automate it. Microsoft has once again decided to do things their own way and longstanding approaches (that work with IE, Firefox, Opera, Brave, …, Access, Excel, Word, …) did not work to automate Edge. Sadly, I was disappointed with my findings. Since everyone is now getting Edge pushed upon them, I thought I should delve a little into what can be done with Edge using VBA to see if it offered any potential advantages for us developers. As part of my previous post VBA – Opening Files and URLs, late one night, I also explored Edge ‘automation’ (and I use that term very loosely here!).











Vba open windows explorer