Command button open a file(path is in CellA1)

Closed
Asif - Nov 15, 2011 at 02:11 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Nov 30, 2011 at 05:48 PM
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 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Nov 30, 2011 at 05:48 PM
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 & """"
0