Share via

GetOpenFilename problems

Anonymous
2011-07-22T21:38:01+00:00

Hi all

Have read a lot about it in old threads and if I understand it correct there is no good way

to use a filterstring that's work with files created on a Mac and on Windows.

Am I correct ?????

And Is Something like this is the way to go if you want to be sure your file is a xls, xlsb or ? (is working in Windows and on a Mac)

Or are there better ideas ?

Sub TestGetOpenFileName()

Dim FileExtension As String

fileToOpen = Application.GetOpenFilename

If fileToOpen <> False Then

FileExtension = LCase(Right(fileToOpen, Len(fileToOpen) - InStrRev(fileToOpen, ".", , 1)))

Select Case FileExtension

' You can use one or more file formats

Case "xls", "xlsb"

MsgBox "Open " & fileToOpen

Case Else

MsgBox "sorry wrong extension, only xls and xlsb files are possible"

End Select

End If

End Sub

Love to know more about it so I can add it to my Excel Mac problem page that I start with.

http://www.rondebruin.nl/mac.htm

Thanks

Regards Ron de Bruin

http://www.rondebruin.nl/tips.htm

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-07-23T11:31:22+00:00

You are correct, there is no easy way to filter the files as can be done under windows. There are, however, many problems with getopenfilename on the Mac. It has been a long and often reported bug (by me) that it often returns an incomplete path. This problem has been around since maybe forever, (at least since before Excel 2004) and has apparently not been deemed important enough to fix. The basic problem is that if the user uses the disclosure triangles to expose files in a folder, the entire path is not returned. If the folders are double clicked instead, the path is correct.

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2011-07-23T12:34:42+00:00

    hi Bob

    I can't reproduce this on my macbook with lion and O2011

    Have you test it there also ?

    Was this answer helpful?

    0 comments No comments