| | |
Error in CreatematerilsTable
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Dec 2008
Posts: 304
Reputation:
Solved Threads: 1
Can anyone tell me why i am getting The requestedmember of the
Collection Does not exist.Runtime error '5941'.Any help would be
Greately appreciated.Cursor go on the bold line.
Collection Does not exist.Runtime error '5941'.Any help would be
Greately appreciated.Cursor go on the bold line.
Sub CreateMaterialsTable()
ActiveDocument.Tables.Add Range:=Selection.Range, Numrows:=3, NumColumns:= _
4, defaulttablebehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
ActiveDocument.Tables(3).Select
'selection is Application.selection object
With ActiveDocument.Tables(3)
If .Style <> "tabellengitternetz" Then
.Style = "Tabellengitternetz"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
ActiveDocument.Tables(3).Rows.HeightRule = wdRowHeightExactly
ActiveDocument.Tables(3).Rows.Height = CentimetersToPoints(0.7)
ActiveDocument.Tables(3).Columns(1).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(1).PreferredWidth = 8
ActiveDocument.Tables(3).Columns(2).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(2).PreferredWidth = 68
ActiveDocument.Tables(3).Columns(3).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(3).PreferredWidth = 12
ActiveDocument.Tables(3).Select
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.Font.Size = 8
Selection.Font.Name = "Arial"
CreateHeader
End Sub Last edited by firoz.raj; May 10th, 2009 at 8:59 am.
try this
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
ActiveDocument.Tables(3).Columns(3).Select
•
•
Join Date: Dec 2008
Posts: 304
Reputation:
Solved Threads: 1
•
•
•
•
try this
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
ActiveDocument.Tables(3).Columns(3).Select
Sub CreateMaterialsTable()
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=3, NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
'ActiveDocument.Tables(3).Select
ActiveDocument.Tables(3).Columns(3).Select
'selection is Application.selection object
With ActiveDocument.Tables(3)
If .Style <> "tabellengitternetz" Then
.Style = "Tabellengitternetz"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
ActiveDocument.Tables(3).Rows.HeightRule = wdRowHeightExactly
ActiveDocument.Tables(3).Rows.Height = CentimetersToPoints(0.7)
ActiveDocument.Tables(3).Columns(1).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(1).PreferredWidth = 8
ActiveDocument.Tables(3).Columns(2).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(2).PreferredWidth = 68
ActiveDocument.Tables(3).Columns(3).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(3).PreferredWidth = 12
ActiveDocument.Tables(3).Select
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.Font.Size = 8
Selection.Font.Name = "Arial"
CreateHeader
Call AddMaterialLine(1, "AMERON QA 308 ZINC PHOSPHATA PRIMAR OD GREY", "LITERS", "100")
Call AddMaterialLine(2, "AMERON QA 304 ZINC PHOSPHATA PRIMAR OD RED", "LITERS", "100")
ActiveDocument.Paragraphs.Last.Range.Select
End Sub•
•
Join Date: Dec 2008
Posts: 304
Reputation:
Solved Threads: 1
[QUOTE=cguan_77;867090]hi firoz.raj make sure that you have three different tables.. what i mean you should have like table1 then table2 then table3.
ex.
still getting error the requested member of the collection does not
exist.here is the code what i have written.
ex.
still getting error the requested member of the collection does not
exist.here is the code what i have written.
Sub CreateMaterialsTable()
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=3, NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
'ActiveDocument.Tables(3).Select
ActiveDocument.Tables(3).Columns(3).Select
'selection is Application.selection object
With ActiveDocument.Tables(3)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
ActiveDocument.Tables(3).Rows.HeightRule = wdRowHeightExactly
ActiveDocument.Tables(3).Rows.Height = CentimetersToPoints(0.7)
ActiveDocument.Tables(3).Columns(1).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(1).PreferredWidth = 8
ActiveDocument.Tables(3).Columns(2).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(2).PreferredWidth = 68
ActiveDocument.Tables(3).Columns(3).PreferredWidthType = wdPreferredWidthPercent
ActiveDocument.Tables(3).Columns(3).PreferredWidth = 12
ActiveDocument.Tables(3).Select
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Selection.Cells.VerticalAlignment = wdCellAlignVerticalCenter
Selection.Font.Size = 8
Selection.Font.Name = "Arial"
CreateHeader
Call AddMaterialLine(1, "AMERON QA 308 ZINC PHOSPHATA PRIMAR OD GREY", "LITERS", "100")
Call AddMaterialLine(2, "AMERON QA 304 ZINC PHOSPHATA PRIMAR OD RED", "LITERS", "100")
ActiveDocument.Paragraphs.Last.Range.Select
End Sub hi, forget to tell you use you original code...try this out.. hope it works.. 

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
ActiveDocument.Tables(3).Select 'ActiveDocument.Tables(3).Columns(3).Select (remove this one)
![]() |
Similar Threads
- Code 19 Registry Error (Windows NT / 2000 / XP)
- Error Loading operating System (Windows NT / 2000 / XP)
- svchost.exe error (Windows NT / 2000 / XP)
- New Hardware Causing Error (Windows NT / 2000 / XP)
- office 2000 install error (Windows NT / 2000 / XP)
- VMWare Unrecoverable Error (*nix Software)
- Error in Wrox Book (Perl)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Convert byte Array to string + VB 6.0
- Next Thread: Search code in a database
Views: 665 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh report retrieve save search sendbyte sites sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






