none
Excel file corrupt RRS feed

  • Question

  • When I try to use Application.FileDialog(msoFileDialogOpen) to open a excel file dialog file in Word, it show me error, the file corrupt, but when i run the code in Excel, ithe same file could be open.

    Dim MyDialog As FileDialog
    Set MyDialog = Application.FileDialog(msoFileDialogOpen)
    MyDialog.Title = "Please choose a file"
    MyDialog.Show

    MyDialog.Execute  'error shows here

    How to settle down this ?

    Greate thanks

    Monday, June 1, 2015 9:15 AM

Answers

  • fix it.

    I  use msoFileDialogFilePicker to chose the file and open the file.

    not the msoFileDialogOpen, may be the msoFileDialogOpen dialog will default it as a word file, so when MyDialog.Execute runs, it shows error

    • Marked as answer by Jenma.Packhum Tuesday, June 2, 2015 6:21 AM
    Tuesday, June 2, 2015 6:21 AM

All replies

  • fix it.

    I  use msoFileDialogFilePicker to chose the file and open the file.

    not the msoFileDialogOpen, may be the msoFileDialogOpen dialog will default it as a word file, so when MyDialog.Execute runs, it shows error

    • Marked as answer by Jenma.Packhum Tuesday, June 2, 2015 6:21 AM
    Tuesday, June 2, 2015 6:21 AM
  • Hi,

    Thanks for sharing your solution.

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, June 2, 2015 7:34 AM
    Moderator