RE: Change documents in word with VBA
- From: Cookie <Cookie@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 23 Oct 2006 07:58:02 -0700
Jay, Thanks for the response. It helped some but I need to expand on my
problem.
The info I need to put in a seprate file is not exactly the same info that
is in the table on the cover page. The code below takes data from a listbox
that is created earlier in the program and depending if if it is selected or
not puts it into the table on the cover sheet. I need to keep this code so
I can still create the cover page and also create code that will put ALL the
data (not just selected) from the list box into a table in a new documentand
save it. It maybe possible to do it all in one procedure but that is over my
head at this point.
Thanks again,
Dim intSelectedRows As Integer
' Dim intColumnIndex As Integer
'
'
' intSelectedRows = 0
' intCounter = 0
' Do Until intCounter = ListBox1.ListCount
' If ListBox1.Selected(intCounter) = True Then
' intSelectedRows = intSelectedRows + 1
' End If
' intCounter = intCounter + 1
' Loop
' Set rng = .Range.Bookmarks("bmkCoverTable").Range
' .Tables.Add Range:=rng, NumRows:=intSelectedRows,
NumColumns:=ListBox1.ColumnCount, _
' DefaultTableBehavior:=wdWord9TableBehavior,
AutoFitBehavior:=wdAutoFitContent
' 'Now add the data to the table
' intCounter = 0 ' number of rows in ListBox1
' intCounter2 = 0 'number of rows in Table
' Do Until intCounter = ListBox1.ListCount
' If ListBox1.Selected(intCounter) = True Then 'this list row has
a check mark
' intCounter2 = intCounter2 + 1 'set table row number
' intColumnIndex = 0 'Listbox column number
' Do Until intColumnIndex + 1 > rng.Tables(1).Columns.Count
' If intColumnIndex = 0 Then 'Unique case for product
data titles
'
rng.Tables(1).Rows(intCounter2).Range.Cells(intColumnIndex + 1).Range.Text = _
' SetProductDataTitle(RTrim(ListBox1.List(intCounter,
intColumnIndex)))
' intColumnIndex = intColumnIndex + 1
' Else
'
rng.Tables(1).Rows(intCounter2).Range.Cells(intColumnIndex + 1).Range.Text = _
' RTrim(ListBox1.List(intCounter, intColumnIndex))
' intColumnIndex = intColumnIndex + 1
' End If
' Loop
' End If
' intCounter = intCounter + 1
' Loop
' 'this area creates the table on the page
' With rng.Tables(1)
' .TopPadding = InchesToPoints(0)
' .BottomPadding = InchesToPoints(0)
' .LeftPadding = InchesToPoints(0)
' .RightPadding = InchesToPoints(0)
' .Rows.Alignment = wdAlignRowCenter
' If intModelCount > 6 Then
' .Range.Paragraphs.Style =
ActiveDocument.Styles("ModelDetails_Small")
' .Rows(1).Range.Paragraphs.Style =
ActiveDocument.Styles("ModelDetails_Small Heading")
' .Columns(1).Select
' Selection.Style = ActiveDocument.Styles("ModelDetails_Small
Heading")
' Else
' .Range.Paragraphs.Style =
ActiveDocument.Styles("ModelDetails")
' .Rows(1).Range.Paragraphs.Style =
ActiveDocument.Styles("ModelDetails Heading")
' .Columns(1).Select
' Selection.Style = ActiveDocument.Styles("ModelDetails
Heading")
' End If
' End With
' End With
'
"Cookie" wrote:
I have an existing VBA application that takes a flat file from and AS/400.
appl and formats into a word document/PDF. There is a table created on the
cover page that I would like to copy to a new document. I have been able to
get the data I need into the table and create the additional document.
However, I have not been able to get the table into the new document. Please
help!
- Prev by Date: Re: find text
- Next by Date: Re: find text
- Previous by thread: Re: Change documents in word with VBA
- Next by thread: Re: Automating the Paper Type?
- Index(es):
Relevant Pages
|