Call "Save As" dialog box as user interface for script?

4 posts / 0 new
Last post
charleshamm
Offline
Joined: 08/14/2015 - 18:44
Call "Save As" dialog box as user interface for script?

Hello and thank you for your help.
I am trying to get my first script off the ground. After the script performs its primary task, I want the user to see the same "save as" dialog box they would see if they manuallly performed the operations in IDEA instead of using the script I'm writing. Trouble is, I can't figure out how to call the below pictured dialog box. I've found something called file explorer, along the lines of Set filebar = CreateObject ("ideaex.FileExplorer"), but it calls a file explorer that selects from IDEA databases internal to the project. Does anyone know how I can call the "save as" dialog box so the users of my script can easily select a location to save the output file?

Images: 
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Charles and welcome to the site.

Here is the code for V9 to use the save dialog.  If you are using a V8 this code won't work so let me know as I will have to dig it up.

Thanks

Brian

Sub Main

	Dim filename As String
	Dim obj As Object
	
	' Access the CommomDialogs object.
	Set obj = Client.CommonDialogs
	
		' Show the Save As dialog box with the applied file filter.
		filename = obj.FileSave("","","IDEA Database Files (*.IMD)|*.IMD|Chart Files (*.xlc)|*.xlc|Worksheet Files (*.xls)|*.xls|Data Files (*.xlc;*.xls)|*.xlc; *.xls|All Files (*.*)|*.*||;")
		
		' Display the selected file name.
		MsgBox filename
		
	' Clear the memory.
	Set obj = Nothing

End Sub

 

charleshamm
Offline
Joined: 08/14/2015 - 18:44

That's exactly what I was looking for, thanks for the quick answer.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Not a problem, glad to help.