![]() |
#1
|
|||
|
|||
![]()
Hello
I'm looking for a macro that will Call Excell from word and open a file called "Dummy.xls" and select the column A and copy the whole column and then exit excell and paste that data in to word. Any help will be greatly appreciated. thanks. Below is a bit of a code that i got but the copy part is not working. Sub CreateNewExcelWB() ' to test this code, paste it into a Word module ' add a reference to the Excel-library ' create a new folder named C:\Foldername or edit the filnames in the code 'Dim xlApp As Excel.Application 'Dim xlWB As Excel.Workbook Dim i As Integer Set xlApp = CreateObject("Excel.Application") xlApp.Visible = True ' Set xlWB = xlApp.Workbooks.Add ' create a new workbook ' or Set xlWB = xlApp.Workbooks.Open("C:\mydocs\windows\desktop\pr ospecting\dummy.xls") ' open an existing workbook ' example excel operations With xlWB.Worksheets(1) Columns("A:A").Select Selection.Copy ' If Dir("C:\Foldername\MyNewExcelWB.xls") <> "" Then ' Kill "C:\Foldername\MyNewExcelWB.xls" ' End If ' .SaveAs ("C:\Foldername\MyNewExcelWB.xls") End With xlWB.Close False ' close the workbook without saving xlApp.Quit ' close the Excel application Set xlWB = Nothing Set xlApp = Nothing End Sub |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook Business Contact Manager, Call Lists | jhscann | Outlook | 1 | 02-01-2011 12:07 PM |
Can you assign a number to a slide and call it up? | satchmo | PowerPoint | 1 | 07-26-2010 06:27 AM |
![]() |
KramerJ | Excel | 2 | 05-11-2009 11:33 AM |
![]() |
retrospect1984 | Excel | 1 | 02-18-2009 06:41 AM |
Phone call through TAPI driver | drdebate | Outlook | 0 | 04-09-2007 01:46 PM |