Word Macros to Manipulate Excel - TexttoColumns

D

Doug Salicblue

Hi,

I've got two separate macros.

The first one is in Word:

Sub FindH()
Set d = ActiveDocument
Set r = d.Range
Set x = GetObject(, "Excel.Application")

r.Find.Highlight = True
r.Find.Forward = True

Do While r.Find.Execute
If r.HighlightColorIndex = wdYellow Then
With x.ActiveCell.Range("A2")
.Value = r
.Activate
End With
End If
intposition = r.End
r.Start = intposition
Loop

End Sub

And the second is in Excel:

Sub Break column

Range("A:B").NumberFormat = "@"
Range("A:A").TextToColumns Destination:=Range("A1"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(7, 1))

End Sub

I want to be able to use the two together on the one macro.
I tried copying in "Range("A:A").TextToColumns..." and placing an "x." in
front of it, but it doesn't work.
"x.Range("A1").Select" works though... So the problem is with texttocolumns
method...

Can anyone help me with this?
Thanks so much in advance!
 
D

Doug Salicblue

One other thing is that i get "Run-time Error 4218 Type Mismatch" if that bit
of information helps.
 

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