My Folder

  • Thread starter Thread starter AJOLSON
  • Start date Start date
A

AJOLSON

I am trying to create a Cmd Button that when the user clicks on it a file is
saved to their My Documents folder. how would I accomplish this using Access
07. thanks
Bleow is what I got so far.

Dim Strtemp As String

Strtemp = Me.Text15 & ".xls"

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Export", _
Strtemp, , Me.JobNumber
 
Thanks that is getting me in the right Direction.

It seems that Public Const CSIDL_NETWORK = &H12 is the Public Constant I
want but I cant figure out how to use it in my code.
How do I call this Funtion up to work on my command button.

Here is what I have so far

Private Sub CMDSaveFile_Click()
Dim Strtemp As String
Dim Temp As String

Strtemp = Me.Text15 & ".xls"



DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "Export", _
"" & Strtemp, , Me.JobNumber
DoCmd.Close acForm, "ExportUS"
DoCmd.SetWarnings False
DoCmd.OpenQuery "DeleteInformation"
DoCmd.SetWarnings True
DoCmd.OpenForm "EnterUSInfo"

End Sub
 
Copy everything in the shaded area on that page (between Code Start and Code
End) and paste it into a new Module (not a class module, nor a module
associated with a form or a report). Make sure you give the module a unique
name (it cannot have the same name as an existing function or sub: try
something like " mdlSpecialFolderLocation")

Change

Strtemp = Me.Text15 & ".xls"

to

Strtemp = fGetSpecialFolderLocation(CSIDL_NETWORK) & _
"\" & Me.Text15 & ".xls"

(at least, I think you have to put the slash in yourself, that the API call
doesn't include it)
 
Back
Top