RE: saving a file using file dialog in Access 2007

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If the api call you referenced is not working for you, then you are not using
it correctly. I have been using it for years with no problems. It has been
so long since I used the file dialog, I don't remember if it is possible
using that object, but I do know that with the api, you can pass a default
file name and that will show as the file name to save.

Here is an example where I do this:

'Set up default path and file
strCurrYear = Me.txtCurrYear
strCurrMonth = Me.cboPeriod.Column(1)
'Set up default path and file
strDefaultDir = "\\rsltx1-bm01\busmgmt\Vought " & strCurrYear & "\" &
strCurrYear _
& " Actuals\" & strCurrMonth & "\FFP Charts\"
strDefaultFileName = Me.cboOffering & " Summary " &
Me.cboPeriod.Column(1) _
& " " & Me.txtCurrYear & ".xls"
'Set filter to show only Excel spreadsheets
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)")
'Flags Hides the Read Only Check and Only allow existing files
lngFlags = ahtOFN_HIDEREADONLY Or ahtOFN_OVERWRITEPROMPT
'Call the Open File Dialog
varGetFileName = ahtCommonFileOpenSave( _
OpenFile:=False, _
InitialDir:=strDefaultDir, _
Filter:=strFilter, _
Filename:=strDefaultFileName, _
Flags:=lngFlags, _
DialogTitle:="Save Report")
If varGetFileName <> "" Then
xlBook.SaveAs Filename:=varGetFileName
End If

--
Dave Hargis, Microsoft Access MVP


"Brian" wrote:

I am trying to use FileDialog in combination with TransferSpreadsheet to save
a file named by the user in a directory of the user's choice. I am able to
bring up the SaveAs dialog box with no problem but the user has to select a
file in order to save the current file as that file.

In my program, the user pulls data specific to a month and year and a table
is created that has in its name the month and year that has just been
entered. Therefore, I would like to avoid having the user retype in the
information and just pass the filename string to save the file using the
dialog box. I have tried using the api0001.htm but quite frankly cannot get
it to work. Regardless, I can get the dialog box to work in either the open
file or save file mode but I need to know if there is a way to save a file
with a string using FileDialog.

I am not a sophisticated programmer, in fact even using "programmer" is a
stretch. :-) Any help will be much appreciated. Thanks,
--
Brian
.



Relevant Pages

  • RE: saving a file using file dialog in Access 2007
    ... Dave Hargis, Microsoft Access MVP ... strCurrYear = Me.txtCurrYear ... information and just pass the filename string to save the file using the ... I am not a sophisticated programmer, in fact even using "programmer" is a ...
    (microsoft.public.access.modulesdaovba)
  • RE: saving a file using file dialog in Access 2007
    ... strCurrYear = Me.txtCurrYear ... 'Call the Open File Dialog ... information and just pass the filename string to save the file using the ... I am not a sophisticated programmer, in fact even using "programmer" is a ...
    (microsoft.public.access.modulesdaovba)
  • Re: .NET and Delphis future
    ... Big name products are still being built for API. ... Real objects, decent languages, business apps ... The world's best kept secret is that an experienced programmer when writing ... desktop apps gets the most value for $ with Delphi. ...
    (borland.public.delphi.non-technical)
  • Re: Function side effects (again)
    ... to a programmer who wrote code as shown above. ... I developed an API that was widely used at my ... They would read the API documentation, but that form of reference still ... to Fortran more or less reading line English and math. ...
    (comp.lang.fortran)
  • Should SWs API give access to all dialogues boxes & commands?
    ... Being an old VB6, programmer, I was every excited about ... API is not consistent with OOP, ... JUST AS THE OPERATOR MAKES SELECTIONS AND ... would allow for a degree of automation that has not yet been. ...
    (comp.cad.solidworks)