Exporting a query into Excel A2003

  • Thread starter Thread starter hansjhamm
  • Start date Start date
H

hansjhamm

All,

I have looked thru the questions and answers for this and can't seem to
get this right.

Below is the code:

Private Sub OK_Click()
Me.Visible = True
DoCmd.OpenQuery "ISS Open Position Query", acViewNormal, acEdit
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "ISS
Open Position Query", "C:\Documents and
Settings\Administrator\MyDocuments\ISS Open Position Query", True, ""
DoCmd.Close acForm, "HR Reporting"
But, I get an error message stating ""C:\Documents....." is not a valid
path. I have checked and it is correct.

Ultimately what I want is for the code to create a new Excel file and
not really save it, but open it and leave the saving and where to save
it to the user....plus alot of other things I need done.
But, I can't even get this to save...

Can anyone help me out?

Thanks,

Hans
 
Are you *sure* that path is correct? By default, the user's documents folder
is named 'My Documents', with a space, not 'MyDocuments' without a space.
 
Brendan,

Thanks sometimes we just get TOO close and cannot see what is right in
front of us. You were correct....

Hans
 
I've been in the same situation myself, Hans. Sometimes you just need a
second pair of eyes! :-) Happy to have helped.
 
Back
Top