I've never used classes before, & I think I'm being a bit on the dim side.
I've imported the class into a project, but then what?
Has anybody got an example to get me going?
Does it need to run from within a form or directly from a module?
TIA
Dave F.
James
' build TIF filename based on dwg name, sheet and revision, and open
SaveAs dialog
Dim strTIFname As String, strTIFpath As String, strTIFtitle As String
strTIFpath = curdwg.Path
strTIFtitle = dwgNum & "_" & sheetNum & "_" & revNum & ".tif"
strTIFname = strTIFpath & "\" & strTIFtitle
Dim oComDlg As New CommonDialog
Dim retVal As Long
Set oComDlg = New CommonDialog
oComDlg.DefaultExt = "tif"
oComDlg.DialogTitle = "Save TIF File"
oComDlg.Filter = "TIF files (*.tif)|*.tif|All files (*.*)|*.*"
oComDlg.Flags = OFN_OVERWRITEPROMPT
oComDlg.InitDir = strTIFpath
'file name (excluding path) and at least 2 NullChar's must fit in
.MaxFileSize
' or else it will cause an error.
'if it's too long just use the null filename that oComDlg initialized
with
If oComDlg.MaxFileSize - 1 > Len(strTIFtitle) Then
oComDlg.FileName = strTIFtitle & String(oComDlg.MaxFileSize -
Len(strTIFtitle), vbNullChar)
End If
retVal = oComDlg.ShowSave
If retVal <= 0 Then 'user cancelled or the API call failed, see
CommonDialog class
'restore the printer configuration path to its previous value before
exiting
curApp.Preferences.Files.PrinterConfigPath = prevPrintCfgPath
Exit Sub
End If
'get the TIF filename that the user picked
strTIFname = oComDlg.FileName
strTIFpath = oComDlg.Path
Set oComDlg = Nothing 'throw away common dialog
I'm trying to find help for the all the flags.
I don't suppose you know of one?
TIA
Dave F.
"James Belshan" <belsh...@nns.com> wrote in message
news:4021296f$1_2@newsprd01...
http://www.google.com/search?q=OFN_OVERWRITEPROMPT+api
From that search:
http://vbnet.mvps.org/index.html?http://vbnet.mvps.org/api/_consts/constso.htm
To use them together, I believe you'll use the OR operator, e.g. (or is it
i.e.)
filebox.flags = OFN_PATHMUSTEXIST Or OFN_OVERWRITEPROMPT Or
OFN_HIDEREADONLY
Good luck,
James
"Dave F" <davi...@NOSPAMburohappold.com> wrote in message
news:402133f6_2@newsprd01...
This seems a bit weird
I've amended your very helpful example slightly
The showopen dialog defaults to the normal Win '98+ open dialog.
But if I add the flag multiselect it displays a really old looking dialog
(Win 3.1?).
Do you know if there's a way to avoid this?
oComDlg.Flags = OFN_ALLOWMULTISELECT
retVal = oComDlg.ShowOpen
TIA
Dave F.
Cheers
Dave F.
"Mike Tuersley" <MikeDOT...@techsoftware.com> wrote in message
news:MPG.1a8c09e37...@discussion.autodesk.com...
Dave,
They are allowed to, and you already are. Frank's CommonDialog.cls is a
wrapper for the API functions. The first lines the module declare the API
functions that are used (GetOpenFilename is the one you're calling -- look
at the ShowOpen function).
Try this:
oComDlg.Flags = OFN_EXPLORER Or OFN_ALLOWMULTISELECT
James
Got it! at http://vbnet.mvps.org
Hey, you know, I think this internet thing might just catch on! ;-)
Now I just need to work out how to parse the string of multiple files names
that gets returned.
Cheers
Dave F.
"James Belshan" <belsh...@nns.com> wrote in message
news:40225727$1_3@newsprd01...
ParseFileNames returns an array of fully-qualified paths. The situation
you described is the default API behavior when querying the selected
file(s) after a multiple selection.
--
There are 10 kinds of people. Those who understand binary and those who
don't.
http://code.acadx.com
(Pull the pin to reply)
> There are other APIs
Not for the OpenFileDialog.
> oComDlg.Flags = OFN_ALLOWMULTISELECT
Always include OFN_EXPLORER.
Well, it sounds like you've already got this solved, but FYI, Frank's
wrapper class has a method that would do this for you, too. Oddly enough,
it's called ParseFileNames ;-) and will return an array of the filenames.
I think the first one may be the path, but I'm not sure.
James
It's not a control. It's a class module wrapper around the API. The
problem is the failure to specify the OFN_EXPLORER flag.
Cheers
Dave F.