06-27-2016 07:07 AM
Hello
Is there any counterpart command to FileDlgShow? Like FileDlgSave?
I have been currently using the following code to allow me better functionality to get file pathways for saving and opening files however the MSComDlg object does not exists on all of my clients machines. I know I could use the FileDlgShow to find file pathways but I was wondering if there was something similar to get file pathways for saving.
I am using 2015 32 but some of my clients are using Diadem 2012.
Function filedialog(filt, def, title, save)
dim dialog, discard
set dialog = CreateObject("MSComDlg.CommonDialog")
dialog.MaxFileSize = 256
if filt = "" then
dialog.Filter = "All Files (*.*)|*.*"
else
dialog.Filter = filt
end if
dialog.FilterIndex = 1
dialog.DialogTitle = title
dialog.InitDir = CreateObject("WScript.Shell").SpecialFolders("MyDocuments")
dialog.FileName = ""
if save = true then
dialog.DefaultExt = def
dialog.Flags = &H800 + &H4
discard = dialog.ShowSave()
'msgbox(dialog.FileName)
else
dialog.Flags = &H1000 + &H4 + &H800
discard = dialog.ShowOpen()
end if
filedialog = dialog.FileName
end function
06-27-2016 07:35 AM
Hi Tim,
You can use the command FileNameGet. The second parameter differentiate between reading and saveing
If (FileNameGet("REPORT", "FileWrite", LayoutReadPath & PicFile & ".TDR") = "IDOk") Then ' Dialog closed with Ok
Call PicSave(FileDlgFileName)
End If
Greetings
Walter
06-27-2016 08:03 AM - edited 06-27-2016 08:09 AM
Excellent Walter Thanks