방법: Excel 파일을 열기 위한 대화 상자 표시
다음 코드는 새 통합 문서를 Microsoft Office Excel에서 열도록 사용자에게 메시지를 표시하고 다중 선택을 허용하는 속성을 설정한 다음 사용 가능한 필터 목록을 지우고 새로운 필터 두 개를 추가합니다. 그런 다음 이 코드에서는 FileDialog 개체의 Execute 메서드를 호출하여 요청된 파일을 엽니다.
적용 대상: 이 항목의 정보는 Excel 2007 및 Excel 2010의 문서 수준 프로젝트 및 응용 프로그램 수준 프로젝트에 적용됩니다. 자세한 내용은 Office 응용 프로그램 및 프로젝트 형식에 따라 사용 가능한 기능을 참조하십시오.
예제
With Me.Application.FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogOpen)
.AllowMultiSelect = True
.Filters.Clear()
.Filters.Add("Excel Files", "*.xls;*.xlw")
.Filters.Add("All Files", "*.*")
If .Show = True Then
.Execute()
End If
End With
Microsoft.Office.Core.FileDialog fd =
this.Application.get_FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogOpen);
fd.AllowMultiSelect = true;
fd.Filters.Clear();
fd.Filters.Add("Excel Files", "*.xls;*.xlw", missing);
fd.Filters.Add("All Files", "*.*", missing);
if (fd.Show() != 0)
{
fd.Execute();
}