ByRef Argument type mismatch

davesmith202

Employee of Access World
Local time
Today, 12:36
Joined
Jul 20, 2001
Messages
522
I have a code snippet taken from here: http://www.mvps.org/access/api/api0001.htm

Code:
'Ask for SaveFileName
strFilter = ahtAddFilterItem(myStrFilter, "Excel Files (*.xls)", "*.xls")
strSaveFileName = ahtCommonFileOpenSave( _
                                    OpenFile:=False, _         
                                    Filter:=strFilter, _
                    Flags:=ahtOFN_OVERWRITEPROMPT Or ahtOFN_READONLY)

It is supposed to bring up a Save As dialog box. However, instead I get the following error:

Compilre error: ByRef Argument type mismatch

The offending item seems to be myStrFilter.

What is supposed to be in myStrFilter?

Thanks,

Dave
 
Found the answer, funnily enough on this forum!

When using this code snippet, you need to change myStrFilter to StrFilter. Also, make sure you add the following likes to your procedure:

Code:
Dim strFilter As String
Dim strSaveFileName As String
 

Users who are viewing this thread

Back
Top Bottom