R
RomanP
I am trying to create in Word document several tables with "Forms.TextBox.1"
controls in each cell. The dimension of each table is 10 columns x 75 rows.
After the creation of 3-rd table Word can not save file and return error
0x80030008 - There is insufficient memory available to complete operation.".
What memory is insufficient? How to solve this problem?
Word 2003 (11.5604.8172).
Code of macro is following:
---------------------------------------------------------------------
Sub InsertTable(rowsNum, columnsNum, controlClassType)
Set myRange = ActiveDocument.ActiveWindow.Selection.Range
Set myTable = myRange.Tables.Add(Range:=myRange, NumRows:=1,
NumColumns:=10)
Set myRows = myTable.rows
For I = 1 To rowsNum
Set myRow = myRows.Add
Set myCells = myRow.Cells
For J = 1 To columnsNum
Set myCell = myCells(J)
Set myRange = myCell.Range
Set myShapes = myRange.InlineShapes
Set myShape = myShapes.AddOLEControl(classType:=controlClassType)
If (controlClassType = "Forms.TextBox.1") Then
myShape.OLEFormat.Object.AutoSize = True ' use only
Else
myShape.OLEFormat.Activate
End If
Next J
ActiveDocument.UndoClear
Next I
End Sub
Sub AppendParagraph()
Set rng = ActiveDocument.Range
rng.Collapse Direction:=wdCollapseEnd
rng.Select
Selection.Range.InsertParagraphAfter
End Sub
Sub TestTablesSave()
myClassType = "Forms.TextBox.1"
InsertTable 75, 10, myClassType
AppendParagraph
ActiveDocument.Save
InsertTable 75, 10, myClassType
AppendParagraph
ActiveDocument.Save
InsertTable 75, 10, myClassType
AppendParagraph
ActiveDocument.Save
End Sub
controls in each cell. The dimension of each table is 10 columns x 75 rows.
After the creation of 3-rd table Word can not save file and return error
0x80030008 - There is insufficient memory available to complete operation.".
What memory is insufficient? How to solve this problem?
Word 2003 (11.5604.8172).
Code of macro is following:
---------------------------------------------------------------------
Sub InsertTable(rowsNum, columnsNum, controlClassType)
Set myRange = ActiveDocument.ActiveWindow.Selection.Range
Set myTable = myRange.Tables.Add(Range:=myRange, NumRows:=1,
NumColumns:=10)
Set myRows = myTable.rows
For I = 1 To rowsNum
Set myRow = myRows.Add
Set myCells = myRow.Cells
For J = 1 To columnsNum
Set myCell = myCells(J)
Set myRange = myCell.Range
Set myShapes = myRange.InlineShapes
Set myShape = myShapes.AddOLEControl(classType:=controlClassType)
If (controlClassType = "Forms.TextBox.1") Then
myShape.OLEFormat.Object.AutoSize = True ' use only
Else
myShape.OLEFormat.Activate
End If
Next J
ActiveDocument.UndoClear
Next I
End Sub
Sub AppendParagraph()
Set rng = ActiveDocument.Range
rng.Collapse Direction:=wdCollapseEnd
rng.Select
Selection.Range.InsertParagraphAfter
End Sub
Sub TestTablesSave()
myClassType = "Forms.TextBox.1"
InsertTable 75, 10, myClassType
AppendParagraph
ActiveDocument.Save
InsertTable 75, 10, myClassType
AppendParagraph
ActiveDocument.Save
InsertTable 75, 10, myClassType
AppendParagraph
ActiveDocument.Save
End Sub