Export to Excel Problem for One User

  • Follow


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 


0
Reply Pam 3/17/2010 2:05:30 PM

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?
-- 
Milton Purdy
ACCESS 
State of Arkansas


"Pam" wrote:

> 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 
> 
> 
> .
> 
0
Reply Utf 3/17/2010 4:11:02 PM


> 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


"golfinray" <golfinray@discussions.microsoft.com> wrote in message 
news:F5BBF2F8-C9D2-4E36-B09A-E50986CADE03@microsoft.com...
> 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?
> -- 
> Milton Purdy
> ACCESS
> State of Arkansas
>
>
> "Pam" wrote:
>
>> 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
>>
>>
>> .
>> 


0
Reply Pam 3/17/2010 4:45:39 PM

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 S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"Pam" wrote:

> > 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
> 
> 
> "golfinray" <golfinray@discussions.microsoft.com> wrote in message 
> news:F5BBF2F8-C9D2-4E36-B09A-E50986CADE03@microsoft.com...
> > 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?
> > -- 
> > Milton Purdy
> > ACCESS
> > State of Arkansas
> >
> >
> > "Pam" wrote:
> >
> >> 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
> >>
> >>
> >> .
> >> 
> 
> 
> .
> 
0
Reply Utf 3/17/2010 11:22:07 PM

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

"Steve Sanford" <limbim53 at yahoo dot com> wrote in message 
news:9484DE3E-17D5-4FED-ADE6-2C51F8BDCFB5@microsoft.com...
> 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 S
> --------------------------------
> "Veni, Vidi, Velcro"
> (I came; I saw; I stuck around.)
>
>
> "Pam" wrote:
>
>> > 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
>>
>>
>> "golfinray" <golfinray@discussions.microsoft.com> wrote in message
>> news:F5BBF2F8-C9D2-4E36-B09A-E50986CADE03@microsoft.com...
>> > 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?
>> > -- 
>> > Milton Purdy
>> > ACCESS
>> > State of Arkansas
>> >
>> >
>> > "Pam" wrote:
>> >
>> >> 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
>> >>
>> >>
>> >> .
>> >>
>>
>>
>> .
>> 


0
Reply Pam 3/18/2010 8:44:28 PM

4 Replies
193 Views

(page loaded in 0.078 seconds)

Similiar Articles:











7/26/2012 9:04:34 PM


Reply: