tags:

views:

100

answers:

2

I would like to know that i have an excel file with 18 sheets and it should be opend with any other versions.

for example if i right click on the file and select open with open office the same is being opened. i would like to lock this.

+1  A: 

not possible. The user or OS decides which programs to invoke.

The best you can do is to obfuscate the data from being read, except with the correct program.

Alex Lim
+1  A: 

That's not strictly correct. You could create a macro that is tied to the Workbook_Open event that checks to see which version of Excel is being used (i.e. Application.Version). For example, you could try doing something like the following:

Private Sub Workbook_Open()
    If Int(Application.Version) <> 11 Then 
       Workbook.Saved = True
       Workbook.Close
    End If
End Sub

However, this won't work if users have macros disabled and I have no idea whether it would work on OpenOffice either. I do know that OpenOffice has a VBA equivalent, but don't know enough about the object models to say whether an Excel macro will behave the exact same way in OpenOffice.

I suspect that the best option is to password-protect your workbook and include a macro that checks to see which version is being used. Not a fool-proof approach but probably the closest you're going to get.

Phil.Wheeler