Hi Doug,
I have just found out the reason why { DOCVARIABLE test } did not get
replaced by the value of txtvarname in the document. Actually, it did get
replaced but i needed to do "Update field" first (right click on it while
it's being highlighted) and then toggle it . Then, the value will show up
when doing print preview. Is this the way it works?
How do i update the field in VBA codes? because we don't want user to right
click on it to update the field everytime they use the template.
Thank you in advance
"Doug Robbins - Word MVP" wrote:
> With the cursor at the location in the document where you want the data to
> appear, Press Ctrl+F9 to insert a pair of field delimiters { } and inside
> them type DOCVARIABLE test
>
> { DOCVARIABLE test }
>
> You must use Ctrl + F9 to insert the { }
>
> Actually however if you toggle the display of the fields using Alt+F9 in the
> document that you already have, you will probably see the field that you
> inserted via the menu system
>
> --
> Hope this helps.
>
> Please reply to the newsgroup unless you wish to avail yourself of my
> services on a paid consulting basis.
>
> Doug Robbins - Word MVP
>
> "Associates"
> news:8148649D-93B5-4006-9DD6-0A061DD10773@microsoft.com...
> > Thank you Doug for your reply.
> >
> > This is what i'm after. However, because this is a new thing to me, I got
> > troubled implementing it. I have googled it and found the steps as below
> >
> > 1. On the Insert menu, click Field.
> > 2. In the Categories box, select Document Automation.
> > 3. In the Field names list, select DocVariable.
> > 4. In the New Name box, under Field properties, type the name of the
> > document variable.
> > 5. Click OK
> >
> > I put the cursor in the area where i want this {DOCVARIABLE "test"} to be
> > and followed the steps above. After clicking "OK" button, nothing happens.
> > I
> > don't see {DOCVARIABLE "test"} any where in the document. I wonder what
> > else
> > are missing here. I tried it a different way but to no avail :(
> >
> > I really appreciate your patience.
> >
> > Thank you in advance
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> >> Instead of bookmarks, use { DOCVARIABLE varname } fields and then you set
> >> and get the data by using the .Value attribute of the variables.
> >>
> >> With ActiveDocument
> >> .Variables("varname").Value = txtvarname.Text
> >> etc
> >> End With
> >>
> >> and to retrieve the information, reverse the bits either side of the =
> >> sign.
> >>
> >> --
> >> Hope this helps.
> >>
> >> Please reply to the newsgroup unless you wish to avail yourself of my
> >> services on a paid consulting basis.
> >>
> >> Doug Robbins - Word MVP
> >>
> >> "Associates"
> >> news:FBC705F6-9852-48D8-A8ED-4AB5CFFD44F6@microsoft.com...
> >> > Hi,
> >> >
> >> > I have a problem with bookmarks. I have a userform called "New
> >> > application
> >> > form" made up for a template .dot. In the word, i have insert bookmarks
> >> > that
> >> > correspond to the text fields in the userform. So, when user finishes
> >> > filling
> >> > out the fields and hit "OK" button, all the data are put into
> >> > bookmarks.
> >> >
> >> > However, what i'm trying to do now is to be able to retrieve all those
> >> > data
> >> > back from bookmarks to the form. I know the code to retrieve values
> >> > from
> >> > bookmarks to textfields in the userform. The reason for this is to
> >> > allow
> >> > user
> >> > to edit some of the data through the form. (don't know if by doing
> >> > this, i
> >> > have made my life more difficult). Anyway, i created another userform
> >> > called
> >> > "Editing application form" and a Edit button (use macro). So when user
> >> > clicks
> >> > on this button, it brings up the "Editing application form" with all
> >> > the
> >> > data
> >> > in their appropriate text fields.
> >> >
> >> > The problem here is When user hits "Edit now" button, i got error
> >> > message
> >> > saying
> >> > "The requested member of the collection doesn't exist". When i checked
> >> > the
> >> > bookmarks, those bookmarks are not there. I believe this is because
> >> > they
> >> > are
> >> > not entered in the first place during the creation of the new
> >> > application
> >> > form. (something new i learn again today)
> >> >
> >> > so is there any other ways that i could use apart from bookmarks and
> >> > still
> >> > helps resolve my issue?
> >> >
> >> > Thank you in advance
> >> >
> >> >
> >>
> >>
> >>
>
>
>