I have a document that needs updating every financial year, apart from a few new stats I have to update the year about 60 times (IE: 2008/09) within the document, so I thought I'd make it a template and have a userform to just input the date and VBA would do the mundane part, but I can't seem to get the code to work,
It says the bookmarks do not exist. (5101) now I think it might be because the Doc has about 6 section breaks, would I need to declare which sections the BM's exist in?
Code:Private Sub cmd_ok_Click() Unload Me 'Entering financial year date into Heading 1 Selection.GoTo What:=wbGoToBookmark, Name:="TitleDate1" Selection.TypeText frmendyear.txtdate Selection.GoTo What:=wbGoToBookmark, Name:="TitleDate2" Selection.TypeText frmendyear.txtdate Selection.GoTo What:=wbGoToBookmark, Name:="TitleDate3" Selection.TypeText frmendyear.txtdate Selection.GoTo What:=wbGoToBookmark, Name:="TitleDate4" Selection.TypeText frmendyear.txtdate 'Entering financial year date into normal text Selection.GoTo What:=wbGoToBookmark, Name:="NormalDate1" Selection.TypeText frmendyear.txtdate Selection.GoTo What:=wbGoToBookmark, Name:="NormalDate2" Selection.TypeText frmendyear.txtdate End Sub




Reply With Quote