Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open save as dialog

Status
Not open for further replies.

Per9922

IS-IT--Management
Oct 1, 2004
74
SE
Hello,

I have created a text file which I would like to save by chhosing in the pop-up save as dialg. How do I get up the save as dialg box ?

Regards
Per
 
From what i read, this is not possible, there was in Windows XP
with SAFRCFileDlg But not in any other windows version
 
Thanks! But

:( I really need this dialog

 
How are you creating this text file? With a VBScript?
 
Hello Nu2java,

Yes, I create the text file with vbsscript. Do you have any idea if it is possible ?

I tried instead to open where to choose the directory with the code below, but the dialog is coming in the background, can I make it to be on top ?

Dim AppShell
Dim BrowseDir
Dim Path
Set AppShell = CreateObject("Shell.Application")
Set BrowseDir = AppShell.BrowseForFolder(0, "choose folder", &H1000, 17)
On Error Resume Next
Path = BrowseDir.Items().Item().Path
If Path = "" Then Exit Sub
MsgBox Path
 
This is probably as close to "Save As" as you can get.
Code:
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("Shell.Application")

Path = oShell.BrowseForFolder(0,"Choose Folder",0,17).Items.Item.Path
Name = InputBox("Please Enter A FileName",,"FileName.txt")

If Path <> "" And Name <> "" Then
	Set TextFile = oFSO.OpenTextFile(Path & Name,2,True)
End If

'Write something in the file.
TextFile.WriteLine "My Save As..."
TextFile.Close
 
Thanks again jkspeed! You are so helpful!!

If you click on the side of the browse folder dialog could end up in the background ... Could that be prevented in some way ? And you do not get it up if you press the button again :(
 
Per9922 said:
If you click on the side of the browse folder dialog could end up in the background ... Could that be prevented in some way ? And you do not get it up if you press the button again :(
That is weird as it's not happening on my end. Tried it with both WinXP and 7. Does it happen to any other dialog boxes or windows?

Going back to your original post, another option that I could think of to make your "Save As" project elegant is to use HTA.
 
Hello jkspeed,

I tried with excel as well. So if you ran the script and by misstake click on the excel sheet the BrowseForFolder will end in the background :(. For me it is easy to get it up but the user that will use my application maybe does not know about it :(

ohh, what is HTA ?

Thanks!!
 
You can read about HTAs here. I'm also starting to experiment with it as some of my scripts require a GUI.
 
Thanks! But I think it is to complex for me :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top