Problem Pasting Data

W

Wayne

I'm having a problem pasting data into Excel using code. 3 remote
users are using the spreadsheet. 2 are having the following problem,
but on the 3rd machine all works fine. All machines are using Office
XP.

I'm copying the data from a Microsoft Access crosstab query by using a
custom menu item in Access that copies all cells of the crosstab query
then opens my spreadsheet. I have a button on the spreadsheet that
runs the code which pastes the copied data then formats the sheet.
The code starts with:

Cells.Select
Selection.ClearContents
Range("A1").Select
ActiveSheet.Paste

The rest of the formatting code is after this.

On the 2 problem machines the code runs but fails to paste the data
copied from Access, then it formats the sheet as desired. On the
third machine the data pastes OK and the code runs as it should. To
ensure that the data was actually being copied to the clipboard on the
problem machines, I had the users open a clean blank workbook and
manually paste the clipboard data into a sheet. This worked fine, so
I know that the Microsoft Access code is copying the data to the
clipboard OK.

Strangely, after manually pasting the data into a clean workbook, the
code in my original workbook will then work and paste the data as it
should.

Is there anything that is obviously wrong with my code above that
would cause it to work on one machine but fail on 2 others?

Any help would be appreciated.
 
J

JCS

Hi Wayne,

Instead of copying and pasting from Access to Excel, why not create a macro
in Access that users the TransferSpreadsheet command? Very easy to do.

John
 
W

Wayne

Hi Wayne,

Instead of copying and pasting from Access to Excel, why not create a macro
in Access that users the TransferSpreadsheet command?  Very easy to do.

John

Thanks John. I hadn't thought of that. I'll give it a go.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top