Export to Excel Problem for One User

  • Thread starter Thread starter Pam
  • Start date Start date
P

Pam

Hi,

I have a user that can't get the command button to work with the following
code to export to excel - nothing happens, no error msg or anything.
Can someone please tell me what to look for to make it work on his computer?

Private Sub Command10_Click()

Const acSpreadsheetTypeExcel9 = 8

Dim strFolderAndFile As String
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9,
"qStatusDayCountAllJobs", "C:\DELTADB\AllJobs.xls"
Dim oApp As Object

Set oApp = CreateObject("Excel.Application")
oApp.Workbooks.Open "C:\deltadb\AllJobs.xls"
oApp.Visible = True

End Sub

Thanks in advance,
Pam
 
Just a silly question: I see you dim strfolderandfile as string, where do you
use that in your code? Another silly question: does the user have Excel on
their machine?
 
Just a silly question: I see you dim strfolderandfile as string, where do
you
use that in your code?
Probably a copy that wasn't really needed and never removed.

Another silly question: does the user have Excel on
their machine?
Yes and I checked to make sure he had the same version (2003 SP3) as I did.

Pam
 
Hi Pam,

I created a directory "DELTADB" on C-drive, duplicated a query (that I know
returns records) and renamed it to "qStatusDayCountAllJobs" and pasted you
code into the click event of a button.

Clicked the button; the Excel workbook "AllJobs.xls" was created and
opened..... no problems.

Are you sure the query returns records (on the one computer)?

Have you set a breakpoint on the first line of the code? Does the code stop
at the breakpoint? If the code never runs (never hit the breakpoint), the
code has become disconnected from the button.

Open taskmanager and click on the processes tab. Is there a copy of Excel
running? If so, end the Excel process and try the button again.

HTH
 
Steve,

Thank you the suggestions. The user in question is out of the office and
has his laptop with him. When he returns, I will try your recommendations.

Thanks again,
Pam
 
Back
Top