Hello everyone,
I've got a macro which opens an excel workbook. This workbook is sometimes saved as xls and sometimes as xlsx. Therefore, as you can see below, i didn't specify a file type. On my laptop this works. The workbook gets opened, regardless of the filetype.
I send the macro and the folder structure on which it relies to a colleague, but when she runs the macro she gets an error that the file can't be found. If I add
to the macro the file gets opened. But then it doesn't work for xlsx files anymore. I'm 99% sure that the filetype is the error, not something else, like a wrong folder hierarchy.
Does anyone have a solution to correct my macro or that it, saypens the xlsx if it doesn't find an xls, etc?
Or does anyone have an idea where the error on my colleague's side is? I've got windows 7, she's got windows 8
My code:
I've got a macro which opens an excel workbook. This workbook is sometimes saved as xls and sometimes as xlsx. Therefore, as you can see below, i didn't specify a file type. On my laptop this works. The workbook gets opened, regardless of the filetype.
I send the macro and the folder structure on which it relies to a colleague, but when she runs the macro she gets an error that the file can't be found. If I add
HTML:
& ".xls"
Does anyone have a solution to correct my macro or that it, saypens the xlsx if it doesn't find an xls, etc?
Or does anyone have an idea where the error on my colleague's side is? I've got windows 7, she's got windows 8
My code:
HTML:
parentfolder = Left(ThisWorkbook.Path, InStrRev(ThisWorkbook.Path, "\") - 1)
Workbooks.Open Filename:= _
parentfolder & "\Reporting\Cognos\Order Income\" & Range("G2") & Range("H2") & " OI (EUR CONS) " & Range("F2")