Solved File Dialog Filter using variable

mjdemaris

Working on it...
Local time
, 22:00
Joined
Jul 9, 2015
Messages
426
Greetings,

Is it possible to use a variable for the dialog filter, i.e.: strFilter set when the function is called via button click, instead of "*.pdf"?

I would like the user to be able to select which type of file they want to add, but the Filters property does not like my string variable.

Thank you.
 
Yes, I think so, but you'll probably need to use two string variables. Just a guess...
 
Yes, I think so, but you'll probably need to use two string variables. Just a guess...

As in:
Code:
.Filters.Add strFileTitle, strFilter
?

Code:
.Filters.Add "PDF File", strFilter
simply throws an error: Error 5: Invalid procedure call or argument.
 
Microsoft's website gives this as one example:
Code:
.Filters.Add "Access Databases", "*.MDB"
The part:
"*.MDB"

....is a literal string. Thus, I think right there you could use a string variable, which equates to *.pdf or whatever
 
Microsoft's website gives this as one example:
Code:
.Filters.Add "Access Databases", "*.MDB"
The part:
"*.MDB"

....is a literal string. Thus, I think right there you could use a string variable, which equates to *.pdf or whatever

Check my edits just above, as I added this in.
 
Oh dang...

I had two versions of code using file dialogs, somewhat integrated, and one version specified using ".pdf" rather than "*.pdf"...

Oops! Where's the face palm when you need it? Thanks guys, sometimes just a quick discussion is all it takes to see the obvious mistakes!

Well, now an example with filter variables exist, lol!
 
Oh dang...

I had two versions of code using file dialogs, somewhat integrated, and one version specified using ".pdf" rather than "*.pdf"...

Oops! Where's the face palm when you need it? Thanks guys, sometimes just a quick discussion is all it takes to see the obvious mistakes!

Well, now an example with filter variables exist, lol!
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom