26
Private Sub Command93_Click()

    Dim f As Object
    Dim strFile As String
    Dim strFolder As String
    Dim varItem As Variant
    Dim P As String
    Dim DeleteEverything As String

        DoCmd.SetWarnings False
        DeleteEverything = "DELETE * FROM [TABLE]"
        DoCmd.RunSQL DeleteEverything

    Set f = Application.FileDialog(3)
    f.AllowMultiSelect = False
    If f.Show Then
        For Each varItem In f.SelectedItems
            strFile = Dir(varItem)
            strFolder = Left(varItem, Len(varItem) - Len(strFile))
            P = strFolder & strFile
        Next
    End If
    Set f = Nothing

        DoCmd.TransferText acImportFixed, "[IMPORT SPECIFICATION]", "[TABLE]", P, False

End Sub

FileDialog を最初に開いたときに特定のフォルダにデフォルト設定する方法は?

4

3 に答える 3

-1

または、ダイアログを開く前に、デフォルトのファイル ディレクトリを次のように変更します。

Application.Options.DefaultFilePath(wdDocumentsPath) = "your\path\here"
于 2016-06-17T15:47:36.770 に答える