PC Review


Reply
Thread Tools Rate Thread

Convert "OutputTo" to vba code

 
 
PJLaux
Guest
Posts: n/a
 
      2nd Aug 2010
I have an access macro which, in the end, creates a table where I use
the "Output" to Action which opens excel where the user is required to
save to a path "Y:\PAYR\Taxes" and to save it as the name that they
want to save it as. Apparently, that is not robust enough, so I need
to create some vba code to save the table in this same path and I
would be creating the name so that it combines several of the combo
and text boxes from the open form, "frm_main" along with the current
date. For example, the name would be something like this.
=Forms![frm_main][Combo_Qu_Or_YTD]&" "&Forms![frm_main][Txt_Year]&"
"&Forms![frm_main][txt_company]&" "&Forms![frm_main][Txt_Year]&"
"&Date().
Can someone please help me with creating the code to run this in a
subprocedure.
Also, is there a way to have an excel macro that automatically
executes some excel vba code, that I created for this spreadsheet, as
soon as this spreadsheet is created or would each user need to have a
specific macro icon set up on their workstation which they can then
activate once this spreadsheet is created.
 
Reply With Quote
 
 
 
 
New Member
Molly Coddlez's Avatar
Join Date: Mar 2011
Location: Manchester
Posts: 19
 
      19th Mar 2011
I presume you'll need the TransferSpeadsheet method for this. If you include the sub in the actual frm_main module itself rather than a seperate module you can avoid using all the Forms![frm_main] stuff too

Code:
Dim strFileNameAndPath as string
strFileNameAndPath = "Y:\PAYR\Taxes\" & Combo_Qu_Or_YTD & " " & Txt_Year & " " & txt_company & " " & Txt_Year & " " & Date() & ".xls"

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel12, "tblTheTable", strFileNameAndPath, True
Any good to you?
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Field Names: "LongName", "ShortName", "Code", "Description","Comments" PeteCresswell Microsoft Access 2 25th Feb 2009 11:41 PM
"Access 2003 Data Available in Preview but not in OutputTo" =?Utf-8?B?aGVscHJkYw==?= Microsoft Access Reports 5 14th May 2007 06:17 PM
LOTUS TRANSITION KEYS "/" "R" / "V" convert formulas to text. =?Utf-8?B?Ym9iQGdvcmRvbmVuZ2luZWVyaW5nLmNvbQ==?= Microsoft Access Getting Started 3 18th Jan 2006 09:15 AM
DoCmd.OutputTo acOutputReport, "rptExport", acFormatTXT - HELP =?Utf-8?B?S2Vsdmlu?= Microsoft Access 3 17th Oct 2005 07:03 AM
Re: Method "Display" of object "mailitem" failed -2147221441 (80040107) when running code in background, code works when stepping through Carol Chisholm Microsoft Outlook VBA Programming 1 6th Sep 2005 03:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:12 AM.