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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasting data into Excel

Status
Not open for further replies.

MinnKota

Technical User
Nov 19, 2003
166
US
I have a form in Access that I would like supliers to fill-out and return the information. Right now, we print the form and fax it; they complete it and then fax it back to us.

I have designed an excel form that looks similar to the Access form we are using and have locked all the cells except the one we want them to fill-out. I have a button on my Access form that I want to take certain fields from the current record and populate certain cells in Excel. What is the best way to do this?

For example code...
The field in the table is [supplier name] and the control on the form is [txtSupplier].
The Excel spreadsheet is "c:\supplier.xls" and the cell in which I want to paste is C3.

Many Thanks
 
Something like this ?
Set myWB = GetObject("c:\supplier.xls")
myWB.Sheets(1).Cells(3, 3) = Me!txtSupplier
myWB.Save
myWB.Application.Quit
Set myWB = Nothing

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV,

It might be working, but I cannot tell. After I run the code you gave me, I open the excel file and see nothing, not even a blank worksheet...I think the code killed my file or hid it.
 
After more investigation...the code is working, but seems to be hiding the worksheet in Excel...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top