Hello,
Relating to a previous post:
"Exporting Word Form Data to Excel"
http://forums.techguy.org/business-applications/257309-exporting-word-form-data-excel.html
regarding the same form in many word docs esported into an excel sheet
My question is whether its possible to export repeated forms in ONE word doc so they collate into 5 columns.
(Would like the first 2 columns and 2 rows left empty )
My form look in word is thus:
Story:
Image: 01
Display-image:
Courtesy:
Caption:
Story:
Image: 02
Display-image:
Courtesy:
Caption:
Story:
Image: 03
Display-image:
Courtesy:
Caption:
etc
Sample.doc is below
This macro obtained from:
"Solved: Export Word Form to Excel"
http://forums.techguy.org/business-applications/1062655-solved-export-word-form-excel.html
works well :up: for the same form in many word docs exported to excel:
Is it possible? .
.
Relating to a previous post:
"Exporting Word Form Data to Excel"
http://forums.techguy.org/business-applications/257309-exporting-word-form-data-excel.html
regarding the same form in many word docs esported into an excel sheet
My question is whether its possible to export repeated forms in ONE word doc so they collate into 5 columns.
(Would like the first 2 columns and 2 rows left empty )
My form look in word is thus:
Story:
Image: 01
Display-image:
Courtesy:
Caption:
Story:
Image: 02
Display-image:
Courtesy:
Caption:
Story:
Image: 03
Display-image:
Courtesy:
Caption:
etc
Sample.doc is below
This macro obtained from:
"Solved: Export Word Form to Excel"
http://forums.techguy.org/business-applications/1062655-solved-export-word-form-excel.html
works well :up: for the same form in many word docs exported to excel:
Code:
Dim vField As FormField
Dim fso As Scripting.FileSystemObject
Dim fsDir As Scripting.Folder
Dim fsFile As Scripting.File
Dim wdApp As Word.Application
Dim myDoc As Word.Document
Dim vColumn As Integer
Dim vLastRow As Integer
Dim x As Integer
Sub AddFormFields()
If ActiveSheet.UsedRange.Count = 1 Then
vLastRow = 1
Else
vLastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1
End If
vColumn = 1
Set fso = New Scripting.FileSystemObject
Set fsDir = fso.GetFolder _
("C:\Documents and Settings\User\Desktop\CIKA 2004\Members\UnProcessed")
Set wdApp = New Word.Application
wdApp.Visible = True
For Each fsFile In fsDir.Files
wdApp.Documents.Open (fsFile)
Set myDoc = wdApp.ActiveDocument
For Each vField In wdApp.Documents(myDoc).FormFields
vField.Select
vValue = vField.Result
Workbooks("Members.xls").Activate
Cells(vLastRow, vColumn).Select
If vField.Type = 71 Then
Select Case vField.Name
Case "Check1"
vColumn = vColumn - 1
If vField.Result = "1" Then
ActiveCell.Value = "YES"
End If
Case "Check2"
If vField.Result = "1" Then
ActiveCell.Value = "NO"
End If
End Select
Else
ActiveCell.Value = vValue
End If
vColumn = vColumn + 1
Next
vColumn = 1
vLastRow = vLastRow + 1
vFileName = wdApp.ActiveDocument.Name
wdApp.ActiveDocument.Close
Name fsFile As _
"C:\Documents and Settings\User\Desktop\CIKA 2004\Members\Processed\" & vFileName
Next
wdApp.Quit
End Sub
.