Command button open a file(path is in CellA1)

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,
Can anyone tell me how to open a file (other than MS office file) from a command button and the file path is sitting in Sheet1 Cell A1
I have tried following but none of them worked what I want. see below...


Theses codes are not working, I think I am missing something in it
Set DmisApp = CreateObject("PCDLRN.Application")
Set DmisParts = DmisApp.PartPrograms.Open(ActiveSheet.Cells(1, 1).Value)
Shell "C:\PCDMISW\PCDLRN.exe (ActiveSheet.Cells(1, 1).Value)"


BELOW EXAMPLE IS WORKING BUT I DONT WANT TO DO THIS WAY, THE REASON IS.... (I want to keep changing the new file in cell A1 so that command button can open whichever file I updated into cellA1. Below is not letting me to change new file unless I go into vba and change it.

Set DmisParts = DmisApp.PartPrograms.Open("R\PCDMISW\PartProgram.PRG")
Shell "C:\PCDMISW\PCDLRN.exe C:\PCDMISW\PartProgram.PRG"


Thanks In Advance

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
If this is working
Set DmisParts = DmisApp.PartPrograms.Open("R\PCDMISW\PartProgram.PRG")
Shell "C:\PCDMISW\PCDLRN.exe C:\PCDMISW\PartProgram.PRG"

then you can change your code as

Set DmisApp = CreateObject("PCDLRN.Application")
Set DmisParts = DmisApp.PartPrograms.Open(ActiveSheet.Cells(1, 1).Value)

Shell "C:\PCDMISW\PCDLRN.exe " & ActiveSheet.Cells(1, 1).Value

or may be this
Shell "C:\PCDMISW\PCDLRN.exe " & ActiveSheet.Cells(1, 1).Value & """"