#1   Report Post  
Posted to microsoft.public.word.newusers
VSK VSK is offline
external usenet poster
 
Posts: 3
Default Macro for Word

Hi Experts,
I am designing a form in word 2003. Want to make a macro which does the
following function. This is for a report generated after I finish the
Instrument installation.
At one customer site, we will install one to many instruments.
I used the Form tool, to put the drop down menu for Quantity of instruments.
Macro i need should be able to create new text fields for entering the
serial number of instruments depending on the quantity of instruments
selected above.
eg: If I select Instrument A is of Qty 2, then 2 text fields should pop up
below in the word document to enter the serial number of that.
Later I should be able to save the document and print out.
Can some one help me with this or if there is any other way, kindly help
suggest.
Thanks and Regards
VSK
  #2   Report Post  
Posted to microsoft.public.word.newusers
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 171
Default Macro for Word

Yeah, sort of.

If you have your dropdown and then at least one text field (assuming
you will always have at least one SN to enter) then you could add a
bookmark "AddFields" after the text field and run this code on exit
from the DropDown:

Sub AddFields()
ActiveDocument.Unprotect
Dim oFF As FormFields
Set oFF = ActiveDocument.FormFields
Dim i As Long
For i = 2 To oFF("DropDown1").DropDown.Value
ActiveDocument.Bookmarks("AddFields").Range.Insert After " "
oFF.Add ActiveDocument.Bookmarks("AddFields").Range,
wdFieldFormTextInput
Next i
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub




On Feb 2, 9:52 am, VSK wrote:
Hi Experts,
I am designing a form in word 2003. Want to make a macro which does the
following function. This is for a report generated after I finish the
Instrument installation.
At one customer site, we will install one to many instruments.
I used the Form tool, to put the drop down menu for Quantity of instruments.
Macro i need should be able to create new text fields for entering the
serial number of instruments depending on the quantity of instruments
selected above.
eg: If I select Instrument A is of Qty 2, then 2 text fields should pop up
below in the word document to enter the serial number of that.
Later I should be able to save the document and print out.
Can some one help me with this or if there is any other way, kindly help
suggest.
Thanks and Regards
VSK



  #3   Report Post  
Posted to microsoft.public.word.newusers
VSK VSK is offline
external usenet poster
 
Posts: 3
Default Macro for Word

Hi Sir,

Thankyou very much for your valuable feedback. I am totally new to the
macros and tried to copy the commands in the macro and execute it.

first I opened the word, created a List box (bookmark as dropdown1) using
formfield. then created a textbox with bookmark as text 1. Then below the
text1 i inserted the Bookmark "Addfields" using the Insert command.

After this I protected the document and selected the number 3. When I exited
nothing happened. But when I went and click the Text1, another text box was
created right below text 1. When I click the Text 2, another text box was
created. In short, it was creating more text box rather than required
everytime i click it.

Can you please give your expert advice.

thanks and regards
VSK

"Greg Maxey" wrote:

Yeah, sort of.

If you have your dropdown and then at least one text field (assuming
you will always have at least one SN to enter) then you could add a
bookmark "AddFields" after the text field and run this code on exit
from the DropDown:

Sub AddFields()
ActiveDocument.Unprotect
Dim oFF As FormFields
Set oFF = ActiveDocument.FormFields
Dim i As Long
For i = 2 To oFF("DropDown1").DropDown.Value
ActiveDocument.Bookmarks("AddFields").Range.Insert After " "
oFF.Add ActiveDocument.Bookmarks("AddFields").Range,
wdFieldFormTextInput
Next i
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub




On Feb 2, 9:52 am, VSK wrote:
Hi Experts,
I am designing a form in word 2003. Want to make a macro which does the
following function. This is for a report generated after I finish the
Instrument installation.
At one customer site, we will install one to many instruments.
I used the Form tool, to put the drop down menu for Quantity of instruments.
Macro i need should be able to create new text fields for entering the
serial number of instruments depending on the quantity of instruments
selected above.
eg: If I select Instrument A is of Qty 2, then 2 text fields should pop up
below in the word document to enter the serial number of that.
Later I should be able to save the document and print out.
Can some one help me with this or if there is any other way, kindly help
suggest.
Thanks and Regards
VSK




  #4   Report Post  
Posted to microsoft.public.word.newusers
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default Macro for Word

You shouldn't be using the control toolbox to enter activeX controls. Use
the ViewToolbars and open the Forms toolbar. Insert a dropdown field (it
will automatically be called dropdown1 by defualt.

Add your numbers (e.g., 1, 2, 3, 4, 5, etc).

Insert the macro text I provided you in the VBA project for the document.

Back in the document, double click the formfield and set AddFields macro to
run on exit. Insert a text field after the dropdown, insert a bookmark
named "AddField" after the text field.

Protect the document and Bob's your uncle.


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


VSK wrote:
Hi Sir,

Thankyou very much for your valuable feedback. I am totally new to the
macros and tried to copy the commands in the macro and execute it.

first I opened the word, created a List box (bookmark as dropdown1)
using formfield. then created a textbox with bookmark as text 1. Then
below the text1 i inserted the Bookmark "Addfields" using the Insert
command.

After this I protected the document and selected the number 3. When I
exited nothing happened. But when I went and click the Text1, another
text box was created right below text 1. When I click the Text 2,
another text box was created. In short, it was creating more text box
rather than required everytime i click it.

Can you please give your expert advice.

thanks and regards
VSK

"Greg Maxey" wrote:

Yeah, sort of.

If you have your dropdown and then at least one text field (assuming
you will always have at least one SN to enter) then you could add a
bookmark "AddFields" after the text field and run this code on exit
from the DropDown:

Sub AddFields()
ActiveDocument.Unprotect
Dim oFF As FormFields
Set oFF = ActiveDocument.FormFields
Dim i As Long
For i = 2 To oFF("DropDown1").DropDown.Value
ActiveDocument.Bookmarks("AddFields").Range.Insert After " "
oFF.Add ActiveDocument.Bookmarks("AddFields").Range,
wdFieldFormTextInput
Next i
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub




On Feb 2, 9:52 am, VSK wrote:
Hi Experts,
I am designing a form in word 2003. Want to make a macro which does
the following function. This is for a report generated after I
finish the Instrument installation.
At one customer site, we will install one to many instruments.
I used the Form tool, to put the drop down menu for Quantity of
instruments. Macro i need should be able to create new text fields
for entering the serial number of instruments depending on the
quantity of instruments selected above.
eg: If I select Instrument A is of Qty 2, then 2 text fields should
pop up below in the word document to enter the serial number of
that.
Later I should be able to save the document and print out.
Can some one help me with this or if there is any other way, kindly
help suggest.
Thanks and Regards
VSK



  #5   Report Post  
Posted to microsoft.public.word.newusers
VSK VSK is offline
external usenet poster
 
Posts: 3
Default Macro for Word

Hi Sir,

I didnt use a control toolbox, instead i said the same way as u have
mentioned. But as I said, before, after I select and exit the dropdown menu,
nothing pops up. But then when I click the text 1 , the second text box pops
up. Even if the selection in the drop down box is 3, the text box creation
continues. This is what confuses me.

Thanks and regarrds
VSK

"Greg Maxey" wrote:

You shouldn't be using the control toolbox to enter activeX controls. Use
the ViewToolbars and open the Forms toolbar. Insert a dropdown field (it
will automatically be called dropdown1 by defualt.

Add your numbers (e.g., 1, 2, 3, 4, 5, etc).

Insert the macro text I provided you in the VBA project for the document.

Back in the document, double click the formfield and set AddFields macro to
run on exit. Insert a text field after the dropdown, insert a bookmark
named "AddField" after the text field.

Protect the document and Bob's your uncle.


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


VSK wrote:
Hi Sir,

Thankyou very much for your valuable feedback. I am totally new to the
macros and tried to copy the commands in the macro and execute it.

first I opened the word, created a List box (bookmark as dropdown1)
using formfield. then created a textbox with bookmark as text 1. Then
below the text1 i inserted the Bookmark "Addfields" using the Insert
command.

After this I protected the document and selected the number 3. When I
exited nothing happened. But when I went and click the Text1, another
text box was created right below text 1. When I click the Text 2,
another text box was created. In short, it was creating more text box
rather than required everytime i click it.

Can you please give your expert advice.

thanks and regards
VSK

"Greg Maxey" wrote:

Yeah, sort of.

If you have your dropdown and then at least one text field (assuming
you will always have at least one SN to enter) then you could add a
bookmark "AddFields" after the text field and run this code on exit
from the DropDown:

Sub AddFields()
ActiveDocument.Unprotect
Dim oFF As FormFields
Set oFF = ActiveDocument.FormFields
Dim i As Long
For i = 2 To oFF("DropDown1").DropDown.Value
ActiveDocument.Bookmarks("AddFields").Range.Insert After " "
oFF.Add ActiveDocument.Bookmarks("AddFields").Range,
wdFieldFormTextInput
Next i
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub




On Feb 2, 9:52 am, VSK wrote:
Hi Experts,
I am designing a form in word 2003. Want to make a macro which does
the following function. This is for a report generated after I
finish the Instrument installation.
At one customer site, we will install one to many instruments.
I used the Form tool, to put the drop down menu for Quantity of
instruments. Macro i need should be able to create new text fields
for entering the serial number of instruments depending on the
quantity of instruments selected above.
eg: If I select Instrument A is of Qty 2, then 2 text fields should
pop up below in the word document to enter the serial number of
that.
Later I should be able to save the document and print out.
Can some one help me with this or if there is any other way, kindly
help suggest.
Thanks and Regards
VSK






  #6   Report Post  
Posted to microsoft.public.word.newusers
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default Macro for Word

Send me your document and I will look at it this evening if I get a
chance.

(delete the CAPS)



--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


VSK wrote:
Hi Sir,

I didnt use a control toolbox, instead i said the same way as u have
mentioned. But as I said, before, after I select and exit the
dropdown menu, nothing pops up. But then when I click the text 1 ,
the second text box pops up. Even if the selection in the drop down
box is 3, the text box creation continues. This is what confuses me.

Thanks and regarrds
VSK

"Greg Maxey" wrote:

You shouldn't be using the control toolbox to enter activeX
controls. Use the ViewToolbars and open the Forms toolbar. Insert
a dropdown field (it will automatically be called dropdown1 by
defualt.

Add your numbers (e.g., 1, 2, 3, 4, 5, etc).

Insert the macro text I provided you in the VBA project for the
document.

Back in the document, double click the formfield and set AddFields
macro to run on exit. Insert a text field after the dropdown,
insert a bookmark named "AddField" after the text field.

Protect the document and Bob's your uncle.


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


VSK wrote:
Hi Sir,

Thankyou very much for your valuable feedback. I am totally new to
the macros and tried to copy the commands in the macro and execute
it.

first I opened the word, created a List box (bookmark as dropdown1)
using formfield. then created a textbox with bookmark as text 1.
Then below the text1 i inserted the Bookmark "Addfields" using the
Insert command.

After this I protected the document and selected the number 3. When
I exited nothing happened. But when I went and click the Text1,
another text box was created right below text 1. When I click the
Text 2, another text box was created. In short, it was creating
more text box rather than required everytime i click it.

Can you please give your expert advice.

thanks and regards
VSK

"Greg Maxey" wrote:

Yeah, sort of.

If you have your dropdown and then at least one text field
(assuming you will always have at least one SN to enter) then you
could add a bookmark "AddFields" after the text field and run this
code on exit from the DropDown:

Sub AddFields()
ActiveDocument.Unprotect
Dim oFF As FormFields
Set oFF = ActiveDocument.FormFields
Dim i As Long
For i = 2 To oFF("DropDown1").DropDown.Value
ActiveDocument.Bookmarks("AddFields").Range.Insert After " "
oFF.Add ActiveDocument.Bookmarks("AddFields").Range,
wdFieldFormTextInput
Next i
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub




On Feb 2, 9:52 am, VSK wrote:
Hi Experts,
I am designing a form in word 2003. Want to make a macro which
does the following function. This is for a report generated
after I finish the Instrument installation.
At one customer site, we will install one to many instruments.
I used the Form tool, to put the drop down menu for Quantity of
instruments. Macro i need should be able to create new text fields
for entering the serial number of instruments depending on the
quantity of instruments selected above.
eg: If I select Instrument A is of Qty 2, then 2 text fields
should pop up below in the word document to enter the serial
number of that.
Later I should be able to save the document and print out.
Can some one help me with this or if there is any other way,
kindly help suggest.
Thanks and Regards
VSK



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Generaters in Word Graham Beaumont Microsoft Word Help 2 May 17th 06 07:11 PM
macro produces error message Kimmie B Microsoft Word Help 11 March 14th 06 11:25 PM
Macro Button Won't Stay on Toolbar caleb Microsoft Word Help 2 June 14th 05 11:59 PM
Possible bug when recording a Word Macro Raven95 Microsoft Word Help 4 April 30th 05 09:49 PM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 05:28 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"