A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

DoCmd.TransferSpreadsheet help



 
 
Thread Tools Display Modes
  #1  
Old January 12th, 2009, 04:40 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default DoCmd.TransferSpreadsheet help

trying to export a query ("PBDM DATE RANGE") to Excel. Is my code wrong or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD
  #2  
Old January 12th, 2009, 05:01 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default DoCmd.TransferSpreadsheet help

What happens when you try running the code? Do you get an error? If so,
what's the erro? If you don't get an error, what does happen?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"GD" wrote in message
...
trying to export a query ("PBDM DATE RANGE") to Excel. Is my code wrong
or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD



  #3  
Old January 12th, 2009, 05:03 PM posted to microsoft.public.access.gettingstarted
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default DoCmd.TransferSpreadsheet help

What is happening that makes you think that there is a problem?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

trying to export a query ("PBDM DATE RANGE") to Excel. Is my code wrong or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD

  #4  
Old January 12th, 2009, 05:06 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default DoCmd.TransferSpreadsheet help

Nothing happens when I click the command button.

--
GD


"Jerry Whittle" wrote:

What is happening that makes you think that there is a problem?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

trying to export a query ("PBDM DATE RANGE") to Excel. Is my code wrong or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD

  #5  
Old January 12th, 2009, 05:38 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default DoCmd.TransferSpreadsheet help

Are you sure that the code is actually linked to the button (code sometimes
gets unlinked).

Look at the Property window. Does it have [Event Procedure] as the value for
the Click property? If you click on the ellipsis (...) to the right of the
property, are you taken into the VB Editor in the midst of that code?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"GD" wrote in message
news
Nothing happens when I click the command button.

--
GD


"Jerry Whittle" wrote:

What is happening that makes you think that there is a problem?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

trying to export a query ("PBDM DATE RANGE") to Excel. Is my code
wrong or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD



  #6  
Old January 12th, 2009, 05:41 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default DoCmd.TransferSpreadsheet help

Doug - Nothing happens when I click the command button. No activity or error
message.
--
GD


"Douglas J. Steele" wrote:

What happens when you try running the code? Do you get an error? If so,
what's the erro? If you don't get an error, what does happen?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"GD" wrote in message
...
trying to export a query ("PBDM DATE RANGE") to Excel. Is my code wrong
or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD




  #7  
Old January 12th, 2009, 05:47 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default DoCmd.TransferSpreadsheet help

Yes, that seems to be OK. Is 9 the right value for an Excel 2003 worksheet?
--
GD


"Douglas J. Steele" wrote:

Are you sure that the code is actually linked to the button (code sometimes
gets unlinked).

Look at the Property window. Does it have [Event Procedure] as the value for
the Click property? If you click on the ellipsis (...) to the right of the
property, are you taken into the VB Editor in the midst of that code?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"GD" wrote in message
news
Nothing happens when I click the command button.

--
GD


"Jerry Whittle" wrote:

What is happening that makes you think that there is a problem?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

trying to export a query ("PBDM DATE RANGE") to Excel. Is my code
wrong or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD




  #8  
Old January 12th, 2009, 05:47 PM posted to microsoft.public.access.gettingstarted
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default DoCmd.TransferSpreadsheet help

There isn't a type 9. Try putting acSpreadsheetTypeExcel9 or 8 instead.

You might want to look into some error trapping as an exception should have
been raised. Or maybe you have Set Warning turned off somewhere?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

Nothing happens when I click the command button.

--
GD


"Jerry Whittle" wrote:

What is happening that makes you think that there is a problem?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

trying to export a query ("PBDM DATE RANGE") to Excel. Is my code wrong or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD

  #9  
Old January 12th, 2009, 06:15 PM posted to microsoft.public.access.gettingstarted
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default DoCmd.TransferSpreadsheet help

As Jerry stated, you should use the named constant acSpreadsheetTypeExcel9
(or acSpreadsheetTypeExcel8)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"GD" wrote in message
...
Yes, that seems to be OK. Is 9 the right value for an Excel 2003
worksheet?
--
GD


"Douglas J. Steele" wrote:

Are you sure that the code is actually linked to the button (code
sometimes
gets unlinked).

Look at the Property window. Does it have [Event Procedure] as the value
for
the Click property? If you click on the ellipsis (...) to the right of
the
property, are you taken into the VB Editor in the midst of that code?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"GD" wrote in message
news
Nothing happens when I click the command button.

--
GD


"Jerry Whittle" wrote:

What is happening that makes you think that there is a problem?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

trying to export a query ("PBDM DATE RANGE") to Excel. Is my code
wrong or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD






  #10  
Old January 12th, 2009, 06:28 PM posted to microsoft.public.access.gettingstarted
gd
external usenet poster
 
Posts: 209
Default DoCmd.TransferSpreadsheet help

Ah, I may have something here. Does it work with parameter queries, or just
selects?
--
GD


"Jerry Whittle" wrote:

There isn't a type 9. Try putting acSpreadsheetTypeExcel9 or 8 instead.

You might want to look into some error trapping as an exception should have
been raised. Or maybe you have Set Warning turned off somewhere?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

Nothing happens when I click the command button.

--
GD


"Jerry Whittle" wrote:

What is happening that makes you think that there is a problem?
--
Jerry Whittle - MS Access MVP 2007 - 2009
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder

"GD" wrote:

trying to export a query ("PBDM DATE RANGE") to Excel. Is my code wrong or
does it need to go further?

Private Sub cmdDCFM_PBDM_Click()
DoCmd.TransferSpreadsheet acExport, 9, "PBDM DATE RANGE", "C:\My
Documents\Trial.xls", True

End Sub

Thanks for your time!

--
GD

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:51 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.