Hi,
I'm developing a template thats updated every financial year, it contains the same year date in it about a 100 times "2008/09" depending on which year its about. I've managed to automate it via a VBA form but the sheer number of bookmarks makes it a up hill task,
To name but a few: (I had to shorten the below list due to the scale of them)
Would anyone know a code that would shorten the above, or is this the only way?Code:Private Sub cmd_ok_Click() 'Entering financial year date into Heading 1 ActiveDocument.Bookmarks("TitleDate1").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("TitleDate2").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("TitleDate3").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("TitleDate4").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("TitleDate5").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("TitleDate6").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("TitleDate7").Select Selection.Text = (frmendyear.txtdate.Text) 'Entering financial year date into standard text ActiveDocument.Bookmarks("textdate1").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("textdate2").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("textdate3").Select Selection.Text = (frmendyear.txtdate.Text) ActiveDocument.Bookmarks("textdate4").Select Selection.Text = (frmendyear.txtdate.Text) 'Entering in 'To' Financial date ActiveDocument.Bookmarks("todate1").Select Selection.Text = (frmendyear.txtto.Text) ActiveDocument.Bookmarks("todate2").Select Selection.Text = (frmendyear.txtto.Text) ActiveDocument.Bookmarks("todate3").Select Selection.Text = (frmendyear.txtto.Text) ActiveDocument.Bookmarks("todate4").Select Selection.Text = (frmendyear.txtto.Text)
Cheers




Reply With Quote