Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export to Excel Template? 3

Status
Not open for further replies.

JavaTurkey

Technical User
Dec 24, 2001
42
US
Basically, I just need to know the jist of how to send the data from a purchase order to an XL spreadsheet. The standard way that Access does it won't cut it though, I created my template and need the fields to go certain places in the XL file. Can anyone help me get started? Thanks-
 
Dim xlobj As Excel.Application
Set xlobj = CreateObject("excel.application")
With xlobj

.Workbooks.Open Filename:="C:\My Documents\pofile.xls"
.Range("C12").Select
.ActiveCell.FormulaR1C1 = "what you want in this cell"
.Range("C14").Select
.ActiveCell.FormulaR1C1 = "what you want in this cell"
.Range("C15").Select
'and so on
.Quit
End With
 
Wow.
Worked like a charm. Now maybe you can help me with the last step - i need to stick an entire query into another part of the XL file...like a one-to-many (its a purchase order - you helped me get the Name/etc. fields in...now i need to get the purchase order items in there) Any ideas? Thanks a ton...
 
sorry i went back in tim the computer that i am working on today does not have excell try this
open your excell start record new macro and move to range that you want enter stop the macro
go in and edit the marco copy and past in to access add dot before each line and it should do as you want
do this for 1 line
afterward loop to force excell to next line
for co = 1 to lines needed

Range("C" & 14+co).Select
'this means select c15 ect
next co
 
I know this might be childish, but could someone show me how to apply the VB coding listed in earlier threads
 
put a command button in your access form and paste the code in the on click event if the command button
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top