View Single Post
 
Old 06-14-2019, 04:12 PM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Your current receive does not open a Word document. Not here at least.


Try


Code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" _
       Alias "ShellExecuteA" (ByVal hwnd As Long, _
                              ByVal lpOperation As String, _
                              ByVal lpFile As String, _
                              ByVal lpParameters As String, _
                              ByVal lpDirectory As String, _
                              ByVal nShowCmd As Long) As Long
Sub Commandbutton()
  Receive InputBox("Enter the file path", "Open Document")
lbl_Exit:
  Exit Sub
End Sub

Public Function Receive(ByVal WhichFilePath As String, _
                               Optional sParams As String = "", _
                               Optional sStartIn As String = vbNullString, _
                               Optional lngOpenMode As Long = 1) As Long
  Receive = ShellExecute(0, vbNullString, WhichFilePath, sParams, sStartIn, lngOpenMode)
lbl_Exit:
  Exit Function
End Function
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote