How can I use the common Save As dialog from VBScript?

后端 未结 9 1787
野性不改
野性不改 2020-12-03 07:50

I\'d like to have my VBScript display the Windows Save As dialog box, but I could not find out how to do it.

Using this code:

Dim sfd
Set sfd = Creat         


        
9条回答
  •  失恋的感觉
    2020-12-03 08:02

    Private Sub cmdB1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdB1.Click
        Dim objExec, strMSHTA, wshShell, SelectFile
    
        SelectFile = ""
    
        ' For use in HTAs as well as "plain" VBScript:
        strMSHTA = "mshta.exe ""about:" & "<" & "input type=file id=FILE>" _
                 & "<" & "script>FILE.click();new ActiveXObject('Scripting.FileSystemObject')" _
                 & ".GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);" & "<" & "/script>"""
    
        wshShell = CreateObject("WScript.Shell")
        objExec = wshShell.Exec(strMSHTA)
    
        SelectFile = objExec.StdOut.ReadLine()
        Me.txtT0.Text = SelectFile
        objExec = Nothing
        wshShell = Nothing
        strMSHTA = Nothing
    End Sub
    

提交回复
热议问题