Assuming you grab the code to which Dale pointed, you'd need something like:
Dim stAppName As String
Dim strFile As String
Dim strFilter As String
stAppName = """C:\Program Files\Google\Google Earth\GoogleEarth.exe"""
strFilter = ahtAddFilterItem(strFilter, "KML Files (*.KML)", "*.KML")
strFile= ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
If Len(strFile) > 0 Then
Call Shell(stAppName & " """ & strFile & """", 1)
End If
Note the extra double quotes there: they're to handle spaces in the file
path. There are three double quotes at the beginning and end of the
statement assigning the value to stAppName. In the call to the Shell
statement, there are three double quotes in front of strFile, and four
double quotes after it.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"efandango" <(E-Mail Removed)> wrote in message
news:F27DAB5E-09DE-45A7-AAF2-(E-Mail Removed)...
> Dale,
>
> I just realised that this method will not work with what I want to do. My
> code as it is, has the benefit of parsing the filename straight to the
> application (Google Earth), so I think the best solution is to have a
> method
> of having a simple Access 'Message Box' pop-up asking for the filename,
> and
> then have that filename merge with the line:
> stAppName = "C:\Program Files\Google\Google Earth\GoogleEarth.exe
>> W:\Folder\Addresses.kml"
>
> do you know how I can get the string variable into this line?
>
> "Dale Fye" wrote:
>
>> Bookmark this site in your internet browser: http://www.mvps.org/access/
>>
>> They have a ton of code examples. In your case, what I think you are
>> looking for is in the API section, at:
>>
>> http://www.mvps.org/access/api/api0001.htm
>>
>> HTH
>> Dale
>>
>>
>> "efandango" <(E-Mail Removed)> wrote in message
>> news:CAD477E5-DF7D-435E-800F-(E-Mail Removed)...
>> > The code below will export the recordset data to a know filename and
>> > known
>> > path.
>> >
>> > I want to be able to have the user create the filename using a message
>> > box,
>> > and then have the code incorporate that filename, add a .kml extenstion
>> > to
>> > the filename and then export the recordset output to it.
>> >
>> > If at all possible, I would love to be able to use the standard windows
>> > file
>> > system dialog boxes, which would allow for a filename and the ability
>> > to
>> > change paths. If not, I would gladly settle for just the dynamic
>> > filename
>> > naming and export.
>> >
>> > these are the lines that contains the pre-exisitng filename: