Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel and Word Automation 2

Status
Not open for further replies.

ThomasT

Aerospace
Nov 6, 2003
1
I am writing a macro in excel that will copy a specifed range of cells, open a document and paste the cells at a specified bookmark in the document.

On copying the cells, and then selecting the bookmark and giving the selection.paste command, it gives an error "The object does not support this method"

Can someone provide a solution?
 
Replies continue below

Recommended for you

COuld you paste here the line that causes this error?
 
ThomasT,
Did you work this macro out ? I'd like a copy if you did...sounds usefull
Thanks,
kook
 
The following code will give you the general idea on how to resolve this problem:

Sub datatransfer()
' Word document to insert Excel data into
file2$ = "C:\Data\Doc1.doc"
chan = DDEInitiate("WinWord", file2$)
Set rangeToPoke = Worksheets("Sheet1").Range("A1:C5")
' BookMark3 is the name of the BookMark where data will be placed
Application.DDEPoke chan, "BookMark3", rangeToPoke
Application.DDETerminate chan
End Sub

This code works for Office 97 in Windows ME. The preceding code will place the data in the range A1:C5 of the active workbook into an existing bookmark called "BookMark3" in an existing document "Doc1.doc" located in a "Data" folder on the C drive.
The problem with this code is that every time you execute the macro, you get a "YesNO" messagebox asking you if want to start the application WinWord.exe even if it is already running.
 
Hi, I'm looking for a Makro or something which help me to get information of a Word-file in Excel. I'm using Office97.
 
Well, copy/Paste works best for most cases.
This is preferable to a general macro.
Beyond that, the need has to be defined precisely for a useful specific macro.
 
...sorry for the intermission

who knows how to use an excel macro to launch an analysis program?

i have to perform a parametric structural analysis, and i intend to create an excel sheet whith all the parameters data, with a macro that activates the structural program at each iteration and also copies the output at each step

is it too tricky?
i am new to vba, hope i do not bother you!

thanks
 
peppiniello:

You should start a new thread for your question.

What is the analysis program? Is it a standalone exe file or is it incorporated in your workbook? This should be pretty simple to do using VBA. We will need more information on how the analysis program is run. DimensionalSolutions@Core.com
While I welcome e-mail messages, please post all thread activity in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor