I need to create a button to load various documents with either word or excel. I have done some test with the Shell command and I have got it to work but I could do with being able to build the shell string from variables rather than having only as static.
This code works fine:
Dim retval As Long
retval = Shell("C:\Program Files\Microsoft Office\Office\excel.exe c:\my_file.xls", 1)
But what I want to be able to do is build it from variables e.g.
The form would have a combo box for the office path,
Another for the folder the excel files are stored in,
Then the file name would be part static part from a combo; so it would look something like:
Shell(Combo_officelocation & “\excel.exe” & “c:\” & Combo_excelfilefolder & “\” & Combo_file_prefix & “filename.xls”)
Is this possible with the shell command or is there another way of achieving this?
Thanks in advance.
This code works fine:
Dim retval As Long
retval = Shell("C:\Program Files\Microsoft Office\Office\excel.exe c:\my_file.xls", 1)
But what I want to be able to do is build it from variables e.g.
The form would have a combo box for the office path,
Another for the folder the excel files are stored in,
Then the file name would be part static part from a combo; so it would look something like:
Shell(Combo_officelocation & “\excel.exe” & “c:\” & Combo_excelfilefolder & “\” & Combo_file_prefix & “filename.xls”)
Is this possible with the shell command or is there another way of achieving this?
Thanks in advance.