PDA

View Full Version : Word to excel



peterwmartin
12-18-2006, 03:40 PM
Hi all I am trying to paste special to excel and whilst I am lost. I have opened the test.xls at one stage. Now when I try to open it again I am getting it is already open for editing by me. can someone please tell me how to close it.



Private Sub wordToExcel()
Dim objExcel As New Excel.Application
Dim wb As Excel.Workbook
Dim FName As String

' Set wb = objExcel.Workbooks.Open(FName)
Set wb = objExcel.Workbooks.Open("C:\Documents and Settings\Peter Martin\Desktop\test.xls")
'Selection.Copy
'wb.Selection.PasteSpecial Link:=True
wb.Close
Set wb = Nothing
End Sub
:banghead:

fumei
12-19-2006, 08:46 AM
You still have objExcel as a valid, live instance of Excel.

cro_dux
02-22-2007, 02:22 PM
I think this is ontopic (no need for new thread):

I made a macro so I can paste special from excel to word as a Formatted Text with link (when I change sht in excel that is updated in word).
I set up coulor and decorate table in word, but when I change data in Excel, is updated in word, but all table properties are lost.
How can I fix this ??

tnx
I.

mdmackillop
02-26-2007, 03:05 PM
Hi Cro-Dux,
Can you post your code?

cro_dux
03-03-2007, 01:08 AM
I didn't saw your message, now macro is more than just c/p in word. I can post new code if you want. Here is just copy/paste in word

Selection.PasteExcelTable True, False, False
Selection.PasteSpecial Link:=True, DataType:=wdPasteRTF, Placement:=wdInLine, DisplayAsIcon:=False