“Save as…” dialog box in MSAccess vba: how?

后端 未结 2 1250
太阳男子
太阳男子 2020-12-18 17:27

In MSAccess I\'ve a mask with a button. When the user clicks on the button, the data in a table are exported on a .txt file:

Private Sub Command_Click()
Dim          


        
相关标签:
2条回答
  • 2020-12-18 18:11

    You can set a reference to the Microsoft Office x.x Object Library and use FileDialog.

    FileDialog Properties

    Sub ShowFileDialog()
        Dim dlgOpen As FileDialog
        Set dlgOpen = Application.FileDialog(msoFileDialogSaveAs)
        With dlgOpen
            .InitialFileName = "Z:\docs\"
            .Show
        End With
    End Sub
    

    Also: How do I get a single file name out of a File Dialog object in VBA (for MS Access 2007)?

    0 讨论(0)
  • 2020-12-18 18:31

    For an API solution see here : http://access.mvps.org/access/api/api0001.htm

    Works well for me. Simply copy and paste in a new module.

    0 讨论(0)
提交回复
热议问题