Hi coders.
Recently I wanted to automate the routine of copying from Word to Excel using this paragraph-copy macro:
Code:
|
Public Sub ParagraphIterator()
Dim myXL As excel.Application 'err is here !!!
excel.Application
Dim iParagraph As Paragraph
Dim iCounter As Long
Set myXL = New excel.Application
my... See moreHi coders. Recently I wanted to automate the routine of copying from Word to Excel using this paragraph-copy macro: Code:
| Public Sub ParagraphIterator()
Dim myXL As excel.Application 'err is here !!!
excel.Application
Dim iParagraph As Paragraph
Dim iCounter As Long
Set myXL = New excel.Application
myXL.Workbooks.Add
iCounter = 0
For Each iParagraph In ActiveDocument.Paragraphs
iCounter = iCounter + 1
myXL.ActiveWorkbook.Worksheets(1).Range("A" & iCounter).Value = iParagraph.Range.Text
Next iParagraph
myXL.ActiveWorkbook.SaveAs "c:\Test.xls"
myXL.Quit
Set myXL = Nothing
End Sub |
|
The problem is it WAS working fine, but in OfficeXP it says to the very first declaration: Dim myXL As excel.Application User-defined type not defined I was going to rework it to copy every single word, but even this version is no go. How I wish I could remember this fine nuance... Could somebody who knows help me please? TIA
[Subject edited by staff or moderator 2009-04-28 13:41 GMT] ▲ Collapse |
|
Have you tried the following.... | Apr 28, 2009 |
Dim myXL As Excel.Application Set myXL = CreateObject("Excel.Application") Hope this help | | |
A reference to the Excel Library is required | Apr 28, 2009 |
Hi, First add the Excel Library (Microsoft Excel 11.0 Object Library) to your project. (Menu -> Tools-> References) Then you can go on.... Mit freundlichen Grüßen / Kind regards Wilhelm Polmann www.sysfilter.com | | |
DZiW (X) ウクライナ 英語 から ロシア語 + ... TOPIC STARTER *solved* thank you | Apr 28, 2009 |
Merci beaucoup, Frederic! Danke schön, Wilhelm! Vieillesse - tristesse. Alter ist ein schweres Malter. Getting old is no too much fun, you know I really did forget to make the reference to Excel first before calling its app type. Cheers. | | |