'=========== BEGIN CODE =========== Public Sub TestFileDialog() Dim otherObject As Excel.Application Dim fdFolder As office.FileDialog Set otherObject = New Excel.Application otherObject.Visible = False Set fdFolder = otherObject.Application.FileDialog(msoFileDialogFolderPicker) fdFolder.Show Debug.Print fdFolder.SelectedItems(1) otherObject.Quit Set otherObject = Nothing End Sub
なるほどね。 自分がわからなければ、知ってるやつにやらせればいいって、ある意味オブジェクト指向ぽいよね。 早速やってみたら、「ユーザー定義型は定義されていません。」てエラーが出る。 何だよ、だめじゃん。 とがっかりしながら、更にググってみると解決法が出ていた。 メニュー>ツール>参照設定と進んで、開いたダイアログの”Microsoft Excel ほにゃららLibrary”にチェックを入れれば良いらしい。 やってみると、ばっちりでしたよ。
--
はれ
Nessun commento:
Posta un commento