Problem with spaces in a filename - button action to open read-only in Excel
In a qvw one field I have is [File]. This includes filenames like "ABC.xlsm" and "ABC 2.xlsm". I have a button on my qvw to open the file indicated by your selections (the button has an enable condition so that it is only actionable when there is a single file based on your selections). All the files are Excel files, and I want the button to open them as read-only.
I thought I had this solved: I was using the following settings for the button action:
Filename: =' /r \\server\folder\' & Only(File)
... where \\server\folder\ is obviously the file location, and Only(File) returns the filename. The /r bit specifies read-only. The settings are shown in the picture below.
BUT I have just realised the button isn't working as intended where there is a space in the filename. So it works for "ABC.xlsm" but not for "ABC 2.xlsm". With "ABC 2.xlsm", it tries to open 2 files in Excel, "ABC" and "2": i.e. it treats the space in the filename as some sort of list delimiter.
Does anybody have any suggestions? I have already tried a few things, none with any success:
Use " " double quotes (this doesn't work as QV thinks it's a bad field name)
Use [ ] square brackets around the filename (then it just thinks one file is called "[ABC" and the other is called "2.xlsm")
Not specifying EXCEL.EXE as the application, and just entering the filepath in "Application" rather than "Filename". This works if I just put in '\\server\folder\' & Only(File) as the Application: i.e. it does work opening files with spaces in, such as ABC 2.xlsm. However, I can't get the syntax to work with the read-only parameter /r.
Unfortunately changing the filenames to exclude spaces is not an option.