copying between office apps ( excel & Word )

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

I've done a little programing in Word & Excel VBA and am
trying to
open a word doc, select some text
Copy to clipboard , then write to Excel feild
or Copy from Excel to Word in the same way.

I normaly find code by creating a macro the examining the
results an looking up things i don't understand in the
help. but the macro dose not work when you switch apps.
 
Hi phil,

You can use the following to do what you want. Add this macro to a
module and then select some text. Then just run the macro


Sub copytoexcel()
Selection.Copy
Set xl = CreateObject("Excel.application")
xl.Workbooks.Add
xl.Range("a1").Select
xl.ActiveSheet.Paste
xl.Application.Visible = True

Set xl = Nothing

End Sub
 
Thanks I'll Give that a go
Phil
-----Original Message-----
Hi phil,

You can use the following to do what you want. Add this macro to a
module and then select some text. Then just run the macro


Sub copytoexcel()
Selection.Copy
Set xl = CreateObject("Excel.application")
xl.Workbooks.Add
xl.Range("a1").Select
xl.ActiveSheet.Paste
xl.Application.Visible = True

Set xl = Nothing

End Sub

*
 
Back
Top