Bug in .Cell(x,y).Range.Text

S

Sonny Maou

The following code does not do what it's supposed to do:

Sub typeCell(tNum As Integer, x As Integer, y As Integer, s As String)
On Error Resume Next
' ActiveDocument.Tables(tNum).Cell(x, y).Range.Text = s
ActiveDocument.Tables(tNum).Cell(x, y).Range.Text = ""
End Sub

For example, if I have "473" in the particular cell, the "3" gets left
behind by this procedure! Is there a bug therein?

Using the commented line, if s was "473," the result would be "4733."

Heeelllp! :)
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < Sonny Maou > écrivait :
In this message, < Sonny Maou > wrote:

|| The following code does not do what it's supposed to do:
||
|| Sub typeCell(tNum As Integer, x As Integer, y As Integer, s As String)
|| On Error Resume Next
|| ' ActiveDocument.Tables(tNum).Cell(x, y).Range.Text = s
|| ActiveDocument.Tables(tNum).Cell(x, y).Range.Text = ""
|| End Sub
||
|| For example, if I have "473" in the particular cell, the "3" gets left
|| behind by this procedure! Is there a bug therein?
||
|| Using the commented line, if s was "473," the result would be "4733."
||
|| Heeelllp! :)

What Word version?

With Word XP your code works as expected.
(I copied/pasted it, and used
'_______________________________________
Sub Test()

typeCell 1, 2, 2, "473"

End Sub
'_______________________________________
to call it.)

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

Steve

I get same results as Jean-Guy -- works fine. I've got Sony Vaio, Win2000,
Office 2000, Word 2000 SR-1.

Sub typeCell(tNum As Integer, x As Integer, y As Integer, s As String)
On Error Resume Next
ActiveDocument.Tables(tNum).Cell(x, y).Range.Text = s
ActiveDocument.Tables(tNum).Cell(x, y).Range.Text = ""
End Sub

Sub test()
Call typeCell(1, 2, 2, "473")
End Sub
 
K

Klaus Linke

Hi Sonny,

No problems in Word2003, either.

Does it only happen with one particular doc?
Might be some table corruption.

Regards,
Klaus
 
S

Sonny Maou

Thank you Jean-Guy, Steve, and Klaus for having a look... I've further
discovered that it happens in table #2, but not table #1, in this
particular document. I don't think there's any table corruption.

Try it with a second table in your test document and let me know how it
goes.

I'm running Word2K, SP-1 in Windows 2K.

Thanks!!
 
S

Sonny Maou

Nevermind this track... I moved the tables around so that table 2 became
table 1, and position doesn't seem to make a difference. The old table 2
still exhibited the problem.

I'll rebuild the table and see what happens.
 

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