Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

sarahallen1
Contributor II

Problem with spaces in a filename - button action to open read-only in Excel

Hello,

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:

Action:           Launch

Application:     EXCEL.EXE

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:

  1. Use " " double quotes (this doesn't work as QV thinks it's a bad field name)
  2. Use [ ] square brackets around the filename (then it just thinks one file is called "[ABC" and the other is called "2.xlsm")
  3. 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.

Your help is much appreciated!

Thanks,
Sarah

button action - read-only in excel.JPG

1 Solution

Accepted Solutions
Not applicable

Re: Problem with spaces in a filename - button action to open read-only in Excel

Hi sarahallen,

In the application box I also placed EXCEL.EXE

In the filename box I placed something like to quickly try it:

"C:\Documents and Settings\User\Dashboard Example.xlsx"

I also tried the option with variable path name. For this I created three variables:

vPath = \\server\folder

vFile = File.xlsx

vPathFile = = '"' & vPath &vFile &'"'

In the filename box of the button I then placed the following text

= vPathFile

Attached the quickly created version with above solution. Note the variable vPathFile is not really required but handy for traceability of what QlikView is doing.

Update 22-5:

I have also been able to pass through read only command, you need to place '/r' in the parameters input box. [Note: this command is not included in the attached qvw]

Kind regards,

Matthijs

4 Replies
Not applicable

Problem with spaces in a filename - button action to open read-only in Excel

Hi,

For me it worked to ensure that the filename with spaces is enclosed with double quotes (""). I did not try if it works with dynamic created filenames

Kind regards,

Matthijs

sarahallen1
Contributor II

Problem with spaces in a filename - button action to open read-only in Excel

Thanks Matthijs.  Could you please tell me exactly where you put the double quotes?

Did you have the /r parameter and EXCEL.EXE specified as the application?

Thanks for your help

Not applicable

Re: Problem with spaces in a filename - button action to open read-only in Excel

Hi sarahallen,

In the application box I also placed EXCEL.EXE

In the filename box I placed something like to quickly try it:

"C:\Documents and Settings\User\Dashboard Example.xlsx"

I also tried the option with variable path name. For this I created three variables:

vPath = \\server\folder

vFile = File.xlsx

vPathFile = = '"' & vPath &vFile &'"'

In the filename box of the button I then placed the following text

= vPathFile

Attached the quickly created version with above solution. Note the variable vPathFile is not really required but handy for traceability of what QlikView is doing.

Update 22-5:

I have also been able to pass through read only command, you need to place '/r' in the parameters input box. [Note: this command is not included in the attached qvw]

Kind regards,

Matthijs

sarahallen1
Contributor II

Re: Problem with spaces in a filename - button action to open read-only in Excel

Hi Matthijs,

Sorry I took so long to get back to you.  I've just tried out your solution (been a busy few months!!!) and it works really well (see settings below). 

Thank you so much.

Kind regards,

Sarah

OpenInExcel.PNG

Community Browser