Hi All

Having real trouble finding out how to do this.

Basically I have done a Word doc that uses Form fields so that I can
auto-copy the contents of say 20 form fields into designated areas of the
remaining doc.

My problem is that textboxes don't seem to auto-update when the user has
tabbed out of a form field (cells in tables do), so I've a little VBA macro
function that goes through all of the references and forces them to update -
inc the textboxes.

My problem is that I need the user to click the padlock icon on the forms
toolbar to unlock the doc so that the user can then click on this macro to
run it.

This 'unclick padlock then click Macro' procedure has to be done for each
copy of the Word doc template that they use, but the user is fine with that.

My functional problem is that I:

a) Can't get the Forms toolbar to be already displayed when the user opens
the copy doc from the template.

b) Can't get my Macro to appear as a clickable toolbar/item/button when the
user opens the copy doc from the template.

Although displaying the Forms toolbar isn't too much of an onerous task for
the user, ie they go View / Toolbars / Forms, getting the Macro to appear on
the menu/toolbar is way too much hassle.

Is there no way, either via VBA or something even more simpler, I can get
these details to auto-display as the user opens the copy doc?

Thanks

RE: How to auto-display the forms toolbar and a macro to click on by gordon(dot)bentleymix(at)gmail(dot)com>

gordon(dot)bentleymix(at)gmail(dot)com>
Mon Jul 14 18:15:00 PDT 2008

Laphan,

You can write code to unlock / re-lock the form automatically.
ActiveDocument.Unprotect and ActiveDocument.Protect wdAllowOnlyFormFields
at the start and end of your macro should do the trick. Of course, there may
be a bit more you need to do - password, etc. Check the VBA help topics on
protection and post back here (preferrably with some code) if you run into
problems.
--
Cheers!
Gordon

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.


"Laphan" wrote:

> Hi All
>
> Having real trouble finding out how to do this.
>
> Basically I have done a Word doc that uses Form fields so that I can
> auto-copy the contents of say 20 form fields into designated areas of the
> remaining doc.
>
> My problem is that textboxes don't seem to auto-update when the user has
> tabbed out of a form field (cells in tables do), so I've a little VBA macro
> function that goes through all of the references and forces them to update -
> inc the textboxes.
>
> My problem is that I need the user to click the padlock icon on the forms
> toolbar to unlock the doc so that the user can then click on this macro to
> run it.
>
> This 'unclick padlock then click Macro' procedure has to be done for each
> copy of the Word doc template that they use, but the user is fine with that.
>
> My functional problem is that I:
>
> a) Can't get the Forms toolbar to be already displayed when the user opens
> the copy doc from the template.
>
> b) Can't get my Macro to appear as a clickable toolbar/item/button when the
> user opens the copy doc from the template.
>
> Although displaying the Forms toolbar isn't too much of an onerous task for
> the user, ie they go View / Toolbars / Forms, getting the Macro to appear on
> the menu/toolbar is way too much hassle.
>
> Is there no way, either via VBA or something even more simpler, I can get
> these details to auto-display as the user opens the copy doc?
>
> Thanks
>
>
>
>

RE: How to auto-display the forms toolbar and a macro to click on by gordon(dot)bentleymix(at)gmail(dot)com>

gordon(dot)bentleymix(at)gmail(dot)com>
Mon Jul 14 18:42:01 PDT 2008

Laphan,

Further to my previous post: You may be able to adapt the following to
ensure that the user has access to your macro.

Public Sub SetToolbar()
Dim bBarFound As Boolean
Dim myCommandBar As CommandBar
bBarFound = False
For Each myCommandBar In CommandBars
If myCommandBar.Name = "Rerun" Then
bBarFound = True
Exit For
End If
Next myCommandBar
If Not bBarFound Then
CommandBars.Add "Rerun"
With CommandBars("Rerun")
.Position = msoBarTop
.Controls.Add Type:=msoControlButton, ID:=1
With .Controls(1)
.FaceId = 1020
.Caption = "Rerun Template"
.Style = msoButtonIconAndCaption
.OnAction = "RerunTemplate"
End With
.Visible = True
End With
Else
With CommandBars("Rerun")
.Position = msoBarTop
With .Controls(1)
If .Type = msoControlButton Then
.Caption = "Rerun Template"
.FaceId = 1020
.Style = msoButtonIconAndCaption
.OnAction = "RerunTemplate"
End If
End With
.Visible = True
End With
myDoc.AttachedTemplate.Saved = True
End If
End Sub

I use this code to display a "Rerun" toolbar for certain documents. It just
tries to find the specified toolbar and if it can't then it builds it. Of
course, your toolbar - assuming you're using one - is undoubtedly
considerably different from mine, so you'll have to modify this code
accordingly. I suppose it could even be re-worked to add a button to one of
the standard toolbars or even a menu.

I call this code at the end of the code that builds the document from the
template, but you could put it into an AutoOpen macro as well. (In fact, I
may even do that myself.) Let me know if you have any questions.
--
Cheers!
Gordon

Uninvited email contact will be marked as SPAM and ignored. Please post all
follow-ups to the newsgroup.


"Laphan" wrote:

> Hi All
>
> Having real trouble finding out how to do this.
>
> Basically I have done a Word doc that uses Form fields so that I can
> auto-copy the contents of say 20 form fields into designated areas of the
> remaining doc.
>
> My problem is that textboxes don't seem to auto-update when the user has
> tabbed out of a form field (cells in tables do), so I've a little VBA macro
> function that goes through all of the references and forces them to update -
> inc the textboxes.
>
> My problem is that I need the user to click the padlock icon on the forms
> toolbar to unlock the doc so that the user can then click on this macro to
> run it.
>
> This 'unclick padlock then click Macro' procedure has to be done for each
> copy of the Word doc template that they use, but the user is fine with that.
>
> My functional problem is that I:
>
> a) Can't get the Forms toolbar to be already displayed when the user opens
> the copy doc from the template.
>
> b) Can't get my Macro to appear as a clickable toolbar/item/button when the
> user opens the copy doc from the template.
>
> Although displaying the Forms toolbar isn't too much of an onerous task for
> the user, ie they go View / Toolbars / Forms, getting the Macro to appear on
> the menu/toolbar is way too much hassle.
>
> Is there no way, either via VBA or something even more simpler, I can get
> these details to auto-display as the user opens the copy doc?
>
> Thanks
>
>
>
>