RP1America
Technical User
I am creating a userform through Word '07 to populate bookmarks within external documents (100+) and then saveas same document name but different folder.
Here is my command button code...where am I going wrong? I know my With...End With is incorrect somewhere.
Thanks!!
Here is my command button code...where am I going wrong? I know my With...End With is incorrect somewhere.
Thanks!!
Code:
Private Sub cmdCreate_click()
Dim strQuarter As String
Dim strQuarterDates As String
Dim strDateText As String
Select Case cboQuarter
Case "1st Quarter"
strQuarter = "first quarter"
strQuarterDates = "(January 1st through March 31st)"
Case "2nd Quarter"
strQuarter = "second quarter"
strQuarterDates = "(April 1st through June 30th)"
Case "3rd Quarter"
strQuarter = "third quarter"
strQuarterDates = "(June 1st through August 31st)"
Case "4th Quarter"
strQuarter = "fourth quarter"
strQuarterDates = "(September 1st through December 31st)"
End Select
strDateText = strQuarter + " of " + txtYear + " " + strQuarterDates
With Document("I:\Ryan Plew\401(k) FS LS Architect A2.doc")
.Bookmarks("QYD").Range.Text = strDateText
.Bookmarks("RT2").Range.Text = txtRT21
.Bookmarks("RT1").Range.Text = txtRT11
.SaveAs ("I:\Ryan Plew\2010Q1\401(k) FS LS Architect A2.doc")
End With
With Document("I:\Ryan Plew\401(k) FS LS Architect A3.doc")
.Bookmarks("QYD").Range.Text = strDateText
.Bookmarks("RT2").Range.Text = txtRT21
.Bookmarks("RT1").Range.Text = txtRT11
.SaveAs ("I:\Ryan Plew\2010Q1\401(k) FS LS Architect A3.doc")
End With
End Sub