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:
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: