1.

Solve : Windows 'Open With....' application/process?

Answer»

I want to open the above application/process using a shell function within MS Access. Can anyone help what type of application file name it is? Is it an .exe file or a .dll or something else.

I'd be grateful for any help on thisI am not sure what you are trying to do. Can you give us some more information? Do you want to add access to the open with list?

No I'm not trying to add Access to the Open With.... list. I want to be able to open the 'Open With...' function from whilst the MS Access. I have managed to get Access to open a file contained within the database and it opens with the associated program eg. Word doc automatically opens with MS Word.

However sometimes it is necessary to open the file with an alternative application if it can't recognise the default setting. So I want to be able to call the Open With... facility to do that.

Hope this is clearer?

Unfortunately these settings are Global....you cannot change it for a specific file.Ok thx for your help
No Problem...
Stop by ANYTIME and Welcome Aboard ! !IF your trying to display open with, you can probably insert this procedure into your Access VBA code:





Code: [Select]
Private Type SHELLEXECUTEINFOA
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
' fields
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type

Private Declare Function GetCurrentProcess Lib "kernel32.dll" () As Long


Private Declare Function ShellExecuteEx Lib "shell32.dll" (ByRef lpExecInfo As SHELLEXECUTEINFOA) As Long



Public Function OpenWith(ByVal FilePath As String, optional ByVal HwndOwner As Long=0,Optional ByVal Icon As Long = 0) As Long

Dim sei As SHELLEXECUTEINFOA
Dim verba As String
verba = "openas"
sei.hIcon = Icon
sei.hProcess = GetCurrentProcess()
sei.hInstApp = App.hInstance

sei.lpVerb = verba
sei.lpFile = FilePath
sei.nShow = vbNormalFocus
sei.cbSize = Len(sei)

OpenWith = ShellExecuteEx(sei)


'Stop

End Function

to call the function, pass in the filename, and optionally a hwnd (from a access form, for example) as well as an icon, if desired. the default icon is usually sufficient.

Additionally, I'm not sure if the "App" object in VB6 is available or the same as it would be in an Access application; I'm certain there is an alternative, however.To BC_Programmer.

Thank you very much indeed. It did the trick - top manExcellent! glad to be of help! I believe, because this was in the "Windows" rather then programming SECTION, other MEMBERS concluded that you wanted to change the association for a specific file, when in fact you wanted to display the DIALOG in your program. Thankfully, I have eagle-eyes for programming problems



Discussion

No Comment Found