Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel to Word ... inserting HeaderFooter in Word document... 1

Status
Not open for further replies.

asjr

Technical User
Jan 3, 2005
6
US
Hello,
I need help with two areas in the following marco. The macro is extracting data from EXCEL into WORD. I'm trying insert data from the sheet into my HeaderFooter and create a list from the STEPS cell. More details are in the marco:


Sub ExceltoWord()
' ExceltoWord Macro

' Creates ExceltoWord documents using Automation
Dim WordApp As Object

' Start Word and create an object (late binding)
Set WordApp = CreateObject("Word.Application")

' Information from worksheet
Set Data = Sheets("MySheet001").Range("A1")

' Cycle through all records in MySheet001
Records = Application.CountA(Sheets("MySheet001").Range("A:A"))
For i = 1 To Records

' Update status bar progress message
Application.StatusBar = "Processing ExceltoWord number " & i

' Assign current data to variables
Number = Data.Cells(i, 1).Value
Description = Data.Cells(i, 2).Value
Users = Data.Cells(i, 3).Value
Steps = Data.Cells(i, 4).Value

' Determine the file name
SaveAsName = ThisWorkbook.Path & "\" & Number & " - " & Users & ".doc"

' Send commands to Word
With WordApp
.Documents.Add
With .Selection

' Wordmacro_Starts_here
'-------------------------------------------------------------------
'Please Help ---> with HeaderFooter code below :)

If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.Font.Name = "Arial"
Selection.Font.Size = 8
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="Number ID: Number"
Selection.Font.Bold = wdToggle
Selection.TypeParagraph
If Selection.Font.Underline = wdUnderlineNone Then
Selection.Font.Underline = wdUnderlineSingle
Else
Selection.Font.Underline = wdUnderlineNone
End If
Selection.TypeText Text:="Audience: Users" & vbTab & vbTab & _
"Version: 1.0"
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.Font.Name = "Arial"
Selection.Font.Size = 8
Selection.TypeText Text:="Confidential" & vbTab & _
"(c) My Company Inc., 2005" & vbTab
NormalTemplate.AutoTextEntries("Page X of Y").Insert Where:=Selection. _
Range, RichText:=True
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

'Please Help ---> HeaderFooter code end here :)

'-------------------------------------------------------------------

.Font.Name = "Arial"
.Font.Size = 18
.Font.Bold = True
.TypeText Text:="Audience_Operators:" & " " & Users
.Font.Size = 12
.TypeParagraph
.TypeParagraph
.TypeParagraph
.TypeText Text:="1. Description"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="" & Description
.TypeParagraph
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.TypeText Text:="2. Users"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="2.1" & vbTab & Users
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.TypeText Text:="4. Flow of Events"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="4.1 Basic Flow"
.TypeParagraph
.TypeParagraph
.TypeText Text:="" & Steps

'------------------------------------------------------------------
Please Help :) I need some code placed here (preferably) that will take data thats coming from Excel and put it into Word on a newline when/if the numbers 1-20 are listed. The data is coming from a column named "Steps" in my Excel docment.

Right now the raw data wrapps in my Word report...

1. The user moves...command. 2. The user enters.... 3. The system retrieves customer account. 4. The System displays warnings messages. 5. The user selects to delete warning(s). 6. The system updates records.


What I need is code that will goto a newline when/if the numbers 1-20 are listed...

1. The user moves...command.
2. The user enters....
3. The system retrieves customer account.
4. The System displays warnings messages.
5. The user selects to delete warning(s).
6. The system updates records.
'------------------------------------------------------------------
.TypeParagraph
.TypeParagraph
End With

'Wordmarco_END_here

.ActiveDocument.SaveAs Filename:=SaveAsName
End With

Next i

' Kill the object
WordApp.Quit
Set WordApp = Nothing

' Reset status bar
Application.StatusBar = ""
MsgBox Records & " ExceltoWord documents were created and save in " & ThisWorkbook.Path

End Sub
 
Oh dear. Ugh. Hmmm.

#1. REPEAT #1!!! Create and use a Style (and it looks that should be plural) for your footer text. All that Font changes and....bleech, bleech. Messy and not needed.

#2. Relates to #1...which is why #1 IS in fact #1. All those .TypeParagraphs? Bleech, if styles are used, these are absolutely not needed. They are un fact a drag on the code.

#3. Could you please write back a sample of EXACTLY how you are picturing the header or fotter to look like? I am a bit confused (especially with all those .TypeParagraphs). i am not not sure which is the header, and which is the footer. Why do you have all those .TypeParagraphs?

It looks like it should be something like:

Audience_Operators:" & " " & Users
{paragraph space)
{paragraph space)
{paragraph space)
1. Description"
{paragraph space)
{paragraph space)
"" & Description
{paragraph space)
{paragraph space)
{paragraph space)
2. Users"
{paragraph space)
{paragraph space)
2.1" & vbTab & Users
{paragraph space)
{paragraph space)
4. Flow of Events"
{paragraph space)
{paragraph space)
4.1 Basic Flow"
{paragraph space)
{paragraph space)
" " & Steps

This is 24 separate lines. Are you sure you want 24 lines in your footer????

Gerry
 
Thanks fumei,
Below is a sample of the Word document I'm trying to build for each record in my sheet. I have most of it working... my challenge is inserting a Header (2-lines) and Footer (1-line) in the Word document. Also, when the data from Excel comes into the Word document I need to list the steps, not wrap the text/data that section. All the .TypeParagraph code is part of the body not the HeaderFooter.

I recorded a marco from Word and placed it in my working Excel marco but encountered errors with the ActiveWindow.View statement and looping (Next i).

Below is a sample of the Word document:


(The 2-line Header - top of document)

Number: xxx xxxx
Audience_Operators: OPS Area Version: 1.0
-----------------------------------------------------------

(The following data is the body of the document)

1. Description
This is the description...

2. Users
2.1 xxxxxx

3. Steps
3.1 Basic Flow

1. The user moves...command.
2. The user enters....
3. The system retrieves customer account.
4. The System displays warnings messages.
5. The user selects to delete warning(s).
6. The system updates records.



(The 1-line footer is - below)
Confidential (c) MyCompany, 2005 Page 1 of 1

-end of document


(The initial code I found on the web but HeaderFooter entries are needed to complete my document. The two things I need are a HeaderFooter and the ability to list incoming data in the STEPS section for each document.)

see initial code below:


Sub ExceltoWord()
' ExceltoWord Macro

' Creates ExceltoWord documents using Automation
Dim WordApp As Object

' Start Word and create an object (late binding)
Set WordApp = CreateObject("Word.Application")

' Information from worksheet
Set Data = Sheets("MySheet001").Range("A1")

' Cycle through all records in MySheet001
Records = Application.CountA(Sheets("MySheet001").Range("A:A"))
For i = 1 To Records

' Update status bar progress message
Application.StatusBar = "Processing ExceltoWord number " & i

' Assign current data to variables
Number = Data.Cells(i, 1).Value
Description = Data.Cells(i, 2).Value
Users = Data.Cells(i, 3).Value
STEPS = Data.Cells(i, 4).Value

' Determine the file name
SaveAsName = ThisWorkbook.Path & "\" & Number & " - " & Users & ".doc"

' Send commands to Word
With WordApp
.Documents.Add
With .Selection

.Font.Name = "Arial"
.Font.Size = 18
.Font.Bold = True
.TypeText Text:="Audience_Operators:" & " " & Users
.Font.Size = 12
.TypeParagraph
.TypeParagraph
.TypeParagraph
.TypeText Text:="1. Description"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="" & Description
.TypeParagraph
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.TypeText Text:="2. Users"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="2.1" & vbTab & Users
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.TypeText Text:="3. Flow of Events"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="3.1 Basic Flow"
.TypeParagraph
.TypeParagraph
.TypeText Text:="" & STEPS
.TypeParagraph
.TypeParagraph
End With

.ActiveDocument.SaveAs Filename:=SaveAsName
End With

Next i

' Kill the object
WordApp.Quit
Set WordApp = Nothing

' Reset status bar
Application.StatusBar = ""
MsgBox Records & " ExceltoWord documents were created and save in " & ThisWorkbook.Path

End Sub


Thanks asjr
 
I ran the basic marco without the HeaderFooter code and it runs fine. Creating a HeaderFooter for each Word doc and listing the steps for each doc is the challenge/problem.

Its a basic Word report with a number of font changes... I can handle the font changes.

Please help!

 
Hi asjr,

I think Gerry is being a bit hard on you. You seem to have done a perfectly reasonable thing and recorded a macro in Word which does what you want. It's not your fault that generated code is pretty horrible at times.

The biggest problem you have is that you are using Word code in an Excel environment. The various references to ActiveWindow and Selection are referring to Excel objects as the code stands and you need to make them refer to Word objects. This may not be 100% correct as I've just manually edited it here, but hopefully it will put you on the right road for the header and footer code ..

Code:
[blue]' Wordmacro_Starts_here
'-------------------------------------------------------------------
'Please Help ---> with HeaderFooter code below

    If [red]WordApp.[/red]ActiveWindow.View.SplitSpecial <> wdPaneNone Then
        [red]WordApp.[/red]ActiveWindow.Panes(2).Close
    End If
    If [red]WordApp.[/red]ActiveWindow.ActivePane.View.Type = wdNormalView Or [red]WordApp.[/red]ActiveWindow. _
        ActivePane.View.Type = wdOutlineView Then
        [red]WordApp.[/red]ActiveWindow.ActivePane.View.Type = wdPrintView
    End If
    [red]WordApp.[/red]ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    .Font.Name = "Arial"
    .Font.Size = 8
    .Font.Bold = wdToggle
    .TypeText Text:="Number ID:  Number"
    .Font.Bold = wdToggle
    .TypeParagraph
    If .Font.Underline = wdUnderlineNone Then
        .Font.Underline = wdUnderlineSingle
    Else
        .Font.Underline = wdUnderlineNone
    End If
    .TypeText Text:="Audience:  Users" & vbTab & vbTab & _
        "Version: 1.0"
    If .HeaderFooter.IsHeader = True Then
        [red]WordApp.[/red]ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
    Else
        [red]WordApp.[/red]ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    End If
    .Font.Name = "Arial"
    .Font.Size = 8
    .TypeText Text:="Confidential" & vbTab & _
        "(c) My Company Inc., 2005" & vbTab
    [red]WordApp.[/red]NormalTemplate.AutoTextEntries("Page X of Y").Insert Where:=Selection. _
        Range, RichText:=True
    [red]WordApp.[/red]ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

'Please Help ---> HeaderFooter code end here[/blue]

When you have the code working, there is a lot you can do to tidy it up, but let's get it working first :)

I'll come back later on your other problem.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
OK. But this is really a design issue. You should be putting the information into a template.

The footer:

This is just text and some fields for the page numbers. This could be in the template footer, and...Done.

If you use a template then there is no need to write the footer, as it would be already written and there.

The header:

Again, use a template. have the text that does NOT change already there. Number, Audience etc. Probably the easiest way - as it avoids dealing with the header/footer objects directly - is to put ActiveX textboxes into the header to hold your variables. Since you are running this as code you can put the data into the ActiveX textbox directly.

NOTE! To do so, you must run the procedure from the ThisDocument module.

So:

Header:

Number: ActiveX textbox named "Number"
Audience Operators: ActiveX textbox named "Op"

then a tab, and text "Version 1.0 - unless that is a variable as well.

in the ThisDocument module have a procedure something like:

Code:
Sub HeaderStuff(strNum As String, strOperator As String)
Number.Text = strNum
Op.Text = strOperator
End Sub

In whatever procedure you are passing the other stuff, like the main body text, have an instruction like:

Call HeaderStuff(strNum, strOperator)

where the arguments strNum and strOperator are the variables you are getting from Excel.

Gerry
 
Tony and fumei, thanks for all the help as I learn Excel/Word automation...

Ok.
I tried adding WordApp but took an error at If .HeaderFooter.IsHeader = True Then

Maybe I'm not clear in whats needed. Let me start over... I know its simple I just can't put it together.

I need to accomplish the following:

1. Build individual Word documents with data coming form Execl
2. Each document must include its own Header/Footer (the header data changes... Excel variable; ex: Item1)

Header example:
Prefix: xxxx 001 <-- (xxx 001) this data changes with incoming EXCEL data>
Environment: xxxxxxxx <--(xxxxxxx) changes with incoming EXCEL data> static ---> Version: 1.0

Footer example:
Copyright (c) MyCompany Inc., 2005 Page X of Y Confidential

(NOTE: The words Prefix:, Environment:, and Version: are static. The font used for both the Header/Footer is Arial 8pt and only the Prefix: xxxx 001 line need to be BOLD.

3. I have 900+ records/documents to create so the marco must successfully loop (For...Next) throughout the sheet.

My Goal in WORD is a document that looks like:
------------
WORD Header area

DATA area coming from ExCEL into WORD

WORD Footer area
------------

Here's the initial untouched macro I used to get started, from The only thing that was not included in the example is to insert a WORD Header/Footer for each new Word document. Again, in the Header there is a variable that changes for each new document.

example:
------------------------------------

Sub MakeWordFile()
' Creates Word document of Auction Items using Automation
Dim WordApp As Object

' Start Word and create an object
Set WordApp = CreateObject("Word.Application")
With WordApp
.Documents.Add
End With

' Determine the file name
SaveAsName = ThisWorkbook.Path & "" & "Auction Catalog.doc"

' Sort Worksheet into proper catalog order
Sheets("Items").Select
Cells.Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, _
Key2:=Range("B2"), Order2:=xlAscending, _
Key1:=Range("C2"), Order3:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A2").Select

' Information from worksheet
Set Data = Sheets("Items").Range("A1")

' Cycle through all records in Items
Records = Application.CountA(Sheets("Items").Range("Title"))
' Records = 7

For i = 2 To Records
' Update status bar progress message
Application.StatusBar = "Processing Record " & i & " of " & Records

' Assign current data to variables
Item1 = Data.Offset(i - 1, 0).Value
Item2 = Data.Offset(i - 1, 1).Value
Title = Data.Offset(i - 1, 2).Value
Descript = Data.Offset(i - 1, 3).Value

' Send commands to Word
With WordApp
With .Selection
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.ParagraphFormat.Alignment = 0
.TypeText Text:=Item1 & Item2 & ". "
.Font.Underline = True
.TypeText Text:=Title
.Font.Bold = False
.Font.Underline = False
.TypeParagraph
.TypeText Text:=Descript
.TypeParagraph
End With
End With
Next i

' Save the Word file and close it
With WordApp
.ActiveDocument.SaveAs FileName:=SaveAsName
.ActiveWindow.Close
' Kill the object
.Quit
End With

Set WordApp = Nothing

' Reset status bar
Application.StatusBar = ""
MsgBox "Auction Catalog.doc was created and saved in " & ThisWorkbook.Path
End Sub


Thanks...
 
Ah, Tony is right (again). I was being a bit hard. Not enough sleep.

I do have to VERY respectfully repeat that the documents should come from a template. If you have a template file, you do NOT have to write anything into the headers and footers. Your static text will already be there. The variable information is insereted into fields directly.

I do not see the need to be writing text into the headers and footers. Inserting the information from Excel, yes. Writing text, no.

There is consistent mention of "creating" the headers and footers. This is not needed at all. A template file, cloned for each document you need, will have those headers. You will not need to vreate them. You just need to fill in the variable information.

The place to start is a standard template with the static portions of the headers and footers already done; properly formatted.

The only thing that was not included in the example is to insert a WORD Header/Footer for each new Word document.
My point being is that if you have a template built with the static elelments, there is no need to insert a Word header/footer for each new document. It will already be there.

Gerry
 
Hum... Okay...

I have created a standard template, MyTemplate.dot, with the requirements. What and where should I place the code in the above marco?


template header example:
Prefix: xxxx 001 <-- (xxx 001) this data changes with incoming EXCEL data>
Environment: xxxxxxxx <--(xxxxxxx) changes with incoming EXCEL data> static ---> Version: 1.0

template footer example:
Copyright (c) MyCompany Inc., 2005 Page X of Y Confidential
Thanks.
 
Hi asjr,

Probably the easiest way is to create a couple of bookmarks in your template.

Edit the TEMPLATE.
Select [blue]xxxx[/blue] in the first header line
Choose Insert > Bookmark... from the menu
Enter, say, [purple]Prefix1[/purple] as the Bookmark name, and Click on Add
Close the Bookmarks Dialog.
Repeat the above for the [blue]001[/blue], calling it, say, [purple]Prefix2[/purple], and the [blue]xxxxxxxx[/blue], calling it, say, [purple]Environment[/purple].
Note that you can choose your own names - I am just using these as examples.
Save the Template.

Now, in your code, ..

Code:
[blue][green]'   Send commands to Word[/green]
    With WordApp
        .Documents.Add [red]"MyTemplate"[/red]
        With .ActiveDocument
            .Bookmarks("Prefix1").Range.Text = "???" [green]' Your data from Excel[/green]
            .Bookmarks("Prefix2").Range.Text = "???" [green]' Your data from Excel[/green]
            .Bookmarks("Environment").Range.Text = "???" [green]' Your data from Excel[/green]

            [green]' Now populate the rest of your document[/green]
            [green]' :[/green]
            [green]' :[/green]

            .SaveAs FileName:=SaveAsName
            .Close

        End With

    End With[/blue]

Is this enough? Or are you still stuck with looping through your Excel data?

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Tony, that will work once, but as you probably know, putting text into bookmark ranges often deletes the bookmark.

There are two possible solutions.

A. To be SURE that the text does not delete the bookmark - assuming the bookmarks Prefix1, Prefix2, and Environment exist:

--- after opening header/footer view and all that crap ----
Selection.GoTo what:=wdGoToBookmark, Name:="Prefix1"
Selection.TypeText Text:=data from Excel
Selection.MoveStart unit:=wdCharacter, Count:=-Len(data from Excel)
ActiveDocument.Bookmarks.Add Name:="Prefix1", Range:=Selection.Range

This inserts the text, and rebuilds the bookmarks range with the length of the inserted text.


B. have Activex controls in header.

In the ThisDocument module (the only one that allows embedded ActiveX control events)

Code:
Sub FillHeader(strIn As String, strIn2 as String, _
   strIn3 As String)
txtPrefix1.Text = strIn1
txtPrefix2.Text = strIn2
txtEnvironment.Text = strIn3
End Sub

When the code to create the instance of Word loads the document, make a call to the FillHeader with the arguments the data from Excel.

Application.Run MacroName:="FillHeader", varg1:=exceldata1, varg2:=exceldata2, varg3:=exceldata3

This will run FillHeader with the parameters passed from Excel, into the ActiveX controls in the header.

This bypasses doing all that Windows View stuff to get at the header object.

Gerry
 
Tony and fumei... once again thanks,

I have built a UCASE2.dot template and staged the following. Do I have all the requirement right? Or is something missing or overlooked? I'm looking at both solutions at the same time.

Please review this version of the macro...

(This is my go-live (actual) production marco.)

'-------------------------------

Sub FillHeader(UseCase As String, Subsystem as String, _
Prefix As String)
txtUseCase.Text = UseCase
txtSubsystem.Text = Subsystem
txtPrefix.Text = Prefix
End Sub

'-------------------------------
Sub UseCase_v4()
' UseCase_v4 Macro

' Creates UseCase Word documnets using Automation
Dim WordApp As Object

' Start Word and create an object (late binding)
Set WordApp = CreateObject("Word.Application")

' Information from worksheet
Set Data = Sheets("InvManagement").Range("A1")

' Cycle through all records
Records = Application.CountA(Sheets("InvManagement").Range("A:A"))
For i = 1 To Records

' Update status bar progress message
Application.StatusBar = "Processing UseCase document " & i
Application.Run MacroName:="FillHeader", varg1:=UseCase, varg2:=Subsystem & " (" & Prefix & ")"

' Assign current data to variables
UseCase = Data.Cells(i, 1).Value
Prefix = Data.Cells(i, 2).Value
Subsystem = Data.Cells(i, 3).Value
Purpose = Data.Cells(i, 4).Value
Description = Data.Cells(i, 5).Value
Actors = Data.Cells(i, 6).Value
Precondition = Data.Cells(i, 7).Value
POS_Navigation = Data.Cells(i, 8).Value
Post_Condition = Data.Cells(i, 9).Value

' Determine the file name
SaveAsName = ThisWorkbook.Path & "\" & UseCase & " - " & Purpose & ".doc"

' Send commands to Word
With WordApp
.Documents.Add "UCASE2"
With .Selection

.TypeParagraph
.TypeParagraph
.Font.Name = "Arial"
.Font.Size = 18
.Font.Bold = True
.TypeText Text:="Use Case Specification:" & " " & Purpose
.Font.Size = 12
.TypeParagraph
.TypeParagraph
.TypeParagraph
.TypeText Text:="1. Description"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="" & Description
.TypeParagraph
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.TypeText Text:="2. Actors"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="2.1" & vbTab & Actors
.TypeParagraph
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.TypeText Text:="3. Pre-Conditions"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="3.1" & vbTab & Precondition
.TypeParagraph
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.TypeText Text:="4. Flow of Events"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="4.1 Basic Flow"
.TypeParagraph
.TypeParagraph
.TypeText Text:="" & POS_Navigation
.TypeParagraph
.TypeParagraph
.TypeParagraph
.Font.Size = 12
.Font.Bold = True
.TypeText Text:="5. Post-Conditions"
.Font.Size = 10
.Font.Bold = False
.TypeParagraph
.TypeParagraph
.TypeText Text:="5.1" & vbTab & Post_Condition
.TypeParagraph
.TypeParagraph

End With

.ActiveDocument.SaveAs Filename:=SaveAsName
End With

Next i

' Kill the object
WordApp.Quit
Set WordApp = Nothing

' Reset status bar
Application.StatusBar = ""
MsgBox Records & " UseCase documents were created and save in " & ThisWorkbook.Path

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top