How do I open a new Excel Workbook from Word

N

Nick Transier

I would like to open a new excel workbook from word and then past
information into it from my word document.

Thanks- Nick
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Nick Transier > écrivait :
In this message said:
I would like to open a new excel workbook from word and then past
information into it from my word document.

For one way of doing it, in the VBE, type "getobject", select it and hit F1.
There is a complete example to do just that.

For pasting stuff into Excel from Word, I would post a question in an Excel
group, like excel.programming.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
M

Martin

You could use some automation. The following example
starts a new Excel application (make sure you've ticked
Microsoft Excel Object Library in Tools, References) then
you can type a dot after the variable name to carry-out
Excel VBA commands (I tend to record a macro in Excel and
paste it across - you can also use a With/End With
statement for your object to save typing!). If you want
to paste from Word, you'd be best defining bookmarks in
the document and referring to those in the code.

Sub LaunchExcel()
Dim objExcel As New Excel.Application

objExcel.Visible = True
'a newly launched Excel window is invisible
objExcel.Wookbooks.Add
objExcel.Range("B6").Value = "Hello Excel!"
 
N

Nick Transier

Thanks Martin.

I am using code just like what you recommended now. I am having a problem
with Excel showing endlines (they show up as little squares) marks when the
information is cut and paste into excel. Any idea how to strip the
formatting (or these endlines) prior to pasting them into the cell?

Thanks- Nick
 
M

Martin

Try Find/Replace while in Word - if you go to the
advanced options there's a lot of the strange codes you
can search for. Also try copying/pasting the endlines
into the find box.

Good luck!
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Nick Transier > écrivait :
In this message said:
Thanks Martin.

I am using code just like what you recommended now. I am having a problem
with Excel showing endlines (they show up as little squares) marks when the
information is cut and paste into excel. Any idea how to strip the
formatting (or these endlines) prior to pasting them into the cell?

What kind of "information" are copying/pasting?
Tables? Complete paragraphs? A few words?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
N

Nick Transier

I am looping through the document selecting para objects and then pasting
the para.range.text into excel, but note that I am not actually cutting and
pasting, instead I am using a statement
excelobject.application.cells(1,1) = para.range.text

Thanks- Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top