set markers for commonly changed text in a report

K

KS

I write reports that have some standard descriptive paragraphs that have
statistical numbers that change with each individual report. I would like to
be able to tab throught the report to change the statistics to have the
report writing go quicker.
 
G

Greg Maxey

Sub ScratchMacro()
Msgbox "What specific VBA assistance do you requires?"
End SUb
 
G

Greg Maxey

KS,

Smart remarks aside ;-). It is really difficult to assist you without a
little more detail. You certainly don't need any VBA to tab through a
report.

Is writing your reports a process where you might open a previous report,
make changes to a few statistics disperssed throughout the report, and then
print and save?

If so then you should save an existing report as a template. Then in the
template bookmark the various statistical entries. E.g.,

Sales: $5,500.00 (Bookmark the $5,500.00 with a bookmark named "bkSales")
Expenses: $3,400.00 (Bookmark the $5,500.00 with a bookmark named
"bkExpenses")

The you could add a Userform to the template and call it with code like
this:

Sub AutoNew
Dim oFrm as UserForm1
Set oFrm = New UserForm1
oFrm.Show
Unload oFrm
Set oFrm = Nothing
End Sub


The UserForm would have label and text fields for inputing sales and
expenses.

Then with a command button click event in the UserForm you could update your
report like this:
Private Sub CommandButton1_Click()
Dim oRng as Word.Range
Dim oBMs as Bookmarks
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("bkSales").Range
oRng.Text = Me.txtSales.Text
oBMs.Add "bkSales", oRng
Set oRng = oBMs("bkExpenses").Range
oRng.Text = Me.txtExpenses.Text
oBMs.Add "bkExpenses", oRng
Me.Hide
End Sub
Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top