Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-14-2011, 05:02 PM
donlincolnmsof donlincolnmsof is offline Call Excel from Word Windows 7 64bit Call Excel from Word Office 2003
Advanced Beginner
Call Excel from Word
 
Join Date: Oct 2011
Posts: 36
donlincolnmsof is on a distinguished road
Smile Call Excel from Word

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
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
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
Call Excel from Word How do I call/execute an Excel macro from Access 2003 KramerJ Excel 2 05-11-2009 11:33 AM
Call Excel from Word Excel to Word retrospect1984 Excel 1 02-18-2009 06:41 AM
Phone call through TAPI driver drdebate Outlook 0 04-09-2007 01:46 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft