Link to home
Start Free TrialLog in
Avatar of newbie46
newbie46

asked on

Is there a way to get around 255 character limit of text stored in Word table cell from Access 2007 VBA?

I am using the following code to write text from Access 2007 to a Word document:
Set rw = doc.Tables(4).Rows.Add
With rw
  .Cells(1).Range.Text="Text longer than 255 characters"
  .Cells(2).Range.Text = "Next column of info"
End with

The text is truncated at 255 characters.
Is there a way to get around this?
Avatar of Stephan_Schrandt
Stephan_Schrandt
Flag of Germany image

Try to use the value property:
 .Cells(1).Range.Value="Text longer than 255 characters"
Avatar of newbie46
newbie46

ASKER

When I compile, I get an error stating that data member not found. When I type .Cells(1).Range., Value isn't one of the options in the dropdown.
sry, I meant Cells(1).Value="Text longer than 255 characters"
After typing in Cells(1)., Value is not in the dropdown. It gives the same error.
I just tested this line in a word document and it works fine:

ActiveDocument.Tables(1).Rows(1).Cells(1).Range.Text = String(1000, "a")

Do you get your cell content from a memo field? If yes, please post the code where you open the recordset.
The cell content is from a memo field. The code is:

strSQL = "SELECT DISTINCT Requirements " & _
                "FROM TempTable " 

Set rs = db.OpenRecordset (strSQL, dbOpenDynaset)
               
ASKER CERTIFIED SOLUTION
Avatar of Stephan_Schrandt
Stephan_Schrandt
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!! I'll find a workaround for the Distinct.