HI Gordon
Thanks for your reply, since your post I have been trying to implement the
coding but I am still getting no where with my document, I was wondering
could you give me some pointers and how I can get started as I just seem to
be making loads of mistakes and it is taking alot longer then initially
anticipated.
My coding for the OK button is as follows so far:
Option Explicit
Private Sub Userform1_Initialize()
End Sub
Private Sub CmdOK_Click()
Dim oRng As Word.Range
Dim oBM As Bookmarks
Set oBM = ActiveDocument.Bookmarks
Set oRng = oBM("DocumentTitle").Range
oRng.Text = DocumentTitle.Text
oBM.Add "DocumentTitle", oRng
Me.Identifier.TextColumn = 2
Set oRng = oBM("Identifier").Range
oRng.Text = Identifier.Text
oBM.Add "Identifier", oRng
Me.Team.TextColumn = 2
Set oRng = oBM("Team").Range
oRng.Text = Team.Text
oBM.Add "Team", oRng
Me.Zone.TextColumn = 2
Set oRng = oBM("Zone").Range
oRng.Text = Zone.Text
oBM.Add "Zone", oRng
Me.DocumentType.TextColumn = 2
Set oRng = oBM("DocumentType").Range
oRng.Text = DocumentType.Text
oBM.Add "DocumentType", oRng
Me.SeqNumber.TextColumn = 2
Set oRng = oBM("SeqNumber").Range
oRng.Text = SeqNumber.Text
oBM.Add "SeqNumber", oRng
Set oRng = oBM("IssueDATE").Range
oRng.Text = IssueDATE.Text
oBM.Add "IssueDATE", oRng
Set oRng = oBM("IssueSTATUS").Range
oRng.Text = IssueSTATUS.Text
oBM.Add "IssueSTATUS", oRng
Dim rngStory As Word.Range
For Each rngStory In ActiveDocument.StoryRanges
'Iterate through all linked stories
Do
rngStory.Fields.Update
'Get next linked story (if any)
Set rngStory = rngStory.NextStoryRange
Loop Until rngStory Is Nothing
Next
Me.Hide
End Sub
Private Sub Userform_Initialize()
Dim myArray1 As Variant
Dim myArray2 As Variant
Dim i As Long
myArray1 = Split("Select Identifier|Arup Halcrow Joint Venture|ESB|" _
& "Irish Rail|Rail Procurement Agency", "|")
myArray2 = Split(" |AH|ES|IE|RP", "|")
With Me.Identifier
.ColumnWidths = "60;0"
For i = 0 To UBound(myArray1)
.AddItem
.List(i, 0) = myArray1(i)
.List(i, 1) = myArray2(i)
Next i
End With
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then Cancel = True
End Sub
My other problem that I am having now is that I had to set up extra list
boxes for new options, Greg Maxey kindly sorted out my list box problem, but
now that I have added new ones, i.e. Team, Zone, DocumentType, SeqNumber I
cant get the extra coding to do anything, as want it to do the same task as
the "Identifier" code works for me.
I also need to add a spin box so that people can spin the number option "00"
up to as far as 20. But again I seem to be doing this wrong, any help please.