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

copy records to clipboard

Status
Not open for further replies.

emtenzer

MIS
Nov 14, 2001
50
US
Is there code to copy all records in an Access table to the clipboard? The final step is pasting them in a specific location on an Excel spreadsheet. I have that worked out, but would like to automate the part of opening a table, selecting all records and copying them. Thanks!
 
Hi,

Why not just insert a query in Excel via Data/Get External Data... that refreshed each time the workbook opens? NO CODE REQUIRED.

Skip,

[glasses] [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering...
"Is there really a DOG?" [tongue]
 
I use a make table query in Access to produce specific records. Then they must be pasted into an existing Excel worksheet in the first blank row (after the existing records). In other words, I'm appending new data each time. I have to put it at the bottom.
 
Your query results are on one sheet.

Then you COPY 'n' Paste to the proper location...
Code:
With [MyQueryResults]
  Range(.Cells(2, 1), Cells(.Rows.Count, .Columns.Count)).Copy _
  Sheets("WhereMyExistingRecordsAre").Cells(Sheets("WhereMyExistingRecordsAre").Rows.Count + 1, 1)
End With


Skip,

[glasses] [red]Be advised:[/red] The dyslexic, agnostic, insomniac, lays awake all night wondering...
"Is there really a DOG?" [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top