Re: Question about saving a *.dbf file

From: Nigel (nigel-9sw_at_suxnospampanet.com)
Date: 05/06/04


Date: Thu, 6 May 2004 07:10:17 +0100

Hi 39N95W
You'll need to change the filter conditions to the following.....

Filt = "DBF file (*.dbf), .dbf"

extract from VBA help.....
This string consists of pairs of file filter strings followed by the MS-DOS
wildcard file filter specification, with each part and each pair separated
by commas. Each separate pair is listed in the Files of type drop-down list
box. For example, the following string specifies two file filters, text and
addin: "Text Files (*.txt), *.txt, Add-In Files (*.xla), *.xla".

Cheers
Nigel

"39N95W" <gkammerer@sunflower.com> wrote in message
news:109jd3djpsp3r47@corp.supernews.com...
> Windows XP
> Excel 2002
>
> I have a bit of code that is supposed to prompt the user for a path and
file
> name to save their workbook in, but I'm getting an error. The user is
> intended to save a single work*** workbook as a dbf file, and all the
> necessary elements are present. Here is the code:
>
> Sub SaveCoordinates()
>
> Dim Filt As String
> Dim FilterIndex As Integer
> Dim Title As String
> Dim FileName As String
> Dim InitialFileName As String
>
> FileName = ""
>
> ' Set up list of file filters
> Filt = "DBF file (*.dbf)"
>
> ' Display *.dbf* by default
> FilterIndex = 1
>
> ' Set the dialog box caption
> Title = "Save Coordinates"
>
> ' Default File name
> InitialFileName = "New_Coord_data"
>
> ' Get the file name
> FileName = Application.GetSaveAsFilename( _
> InitialFileName:=InitialFileName, _
> FileFilter:=Filt, _
> FilterIndex:=FilterIndex, _
> Title:=Title)
>
> Application.DisplayAlerts = False
> ActiveWorkbook.SaveAs FileName:=FileName
> Application.DisplayAlerts = True
>
> End Sub
>
>
> So, could someone kindly tell me what is wrong with the above code?
>
> Any help greatly appreciated - thanks!
>
> -gk-
>
>