Jump to content
Sign in to follow this  
rrenis

Opening an Excel File that has spaces in Filename

Recommended Posts

rrenis

Hi all, I guess this is easy but I can't get it to work :P

I have the following code which I need to open a speadsheet but it assumes each word of the spreadsheet name is a seperate spreadsheet and therefore tries to open 'example.xls', 'spreadsheet.xls', 'with.xls' etc...

Does anyone know what to alter in order for this to work?

$file_location = "example spreasheet with username attached - " & @username
Run("C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" & " " & $file_location & "")

Cheers,

rrenis

Share this post


Link to post
Share on other sites
sigil

Search the forums for the ExcelCOM UDF. It has functions, such as _ExcelBookOpen, for opening Excel spreadsheets; these functions accept strings with spaces in them.

Share this post


Link to post
Share on other sites
rrenis

Search the forums for the ExcelCOM UDF. It has functions, such as _ExcelBookOpen, for opening Excel spreadsheets; these functions accept strings with spaces in them.

Thanks for the quick response sigil :P

Share this post


Link to post
Share on other sites
picaxe

Try

$file_location = "example spreasheet with username attached - " & @username
Run("f:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" & ' "' & $file_location & '"')

Share this post


Link to post
Share on other sites
rrenis

Try

$file_location = "example spreasheet with username attached - " & @username
Run("f:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE" & ' "' & $file_location & '"')
That work's great - many thanks!!! :P

Cheers,

rrenis

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×