If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
help with macros
Hi All.
I have to create a mail merge button which when clicked will merge specific selected feilds from a word document and create a label tag. I want to know if this can be automated and done. Ideally the user should be prompted for what to enter and based on his input the values should be displayed as a label. Thanks for your help in advance. |
#2
|
|||
|
|||
help with macros
This doesn't sound much like a merge to me? You appear to want to extract
information from a document and create a label from that information? That being the case, what is the information and how will the macro recognize it from the document? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org vandy wrote: Hi All. I have to create a mail merge button which when clicked will merge specific selected feilds from a word document and create a label tag. I want to know if this can be automated and done. Ideally the user should be prompted for what to enter and based on his input the values should be displayed as a label. Thanks for your help in advance. |
#3
|
|||
|
|||
help with macros
Hi Graham,
Yes you are right. I need to extract specific field values from a word document and create a label tag out of it. I have an inspection report which has project data like Project desc, project no, Component desc, Dwg no input. I have to extract this information and create a product tag. Is this possible. I am not very good at macros. So any macro example which extracts data to print will be of immense help. Thanks in advance. "Graham Mayor" wrote: This doesn't sound much like a merge to me? You appear to want to extract information from a document and create a label from that information? That being the case, what is the information and how will the macro recognize it from the document? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org vandy wrote: Hi All. I have to create a mail merge button which when clicked will merge specific selected feilds from a word document and create a label tag. I want to know if this can be automated and done. Ideally the user should be prompted for what to enter and based on his input the values should be displayed as a label. Thanks for your help in advance. |
#4
|
|||
|
|||
help with macros
You would have to advise how the data is arranged in the reports, is the
data always arranged in that way, etc. before anyone could suggest a macro to you. You might want to think however about designing the reports so that the data extraction is facilitated. See http://www.mousetrax.com/techpage.html#autoforms -- 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 "vandy" wrote in message ... Hi Graham, Yes you are right. I need to extract specific field values from a word document and create a label tag out of it. I have an inspection report which has project data like Project desc, project no, Component desc, Dwg no input. I have to extract this information and create a product tag. Is this possible. I am not very good at macros. So any macro example which extracts data to print will be of immense help. Thanks in advance. "Graham Mayor" wrote: This doesn't sound much like a merge to me? You appear to want to extract information from a document and create a label from that information? That being the case, what is the information and how will the macro recognize it from the document? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org vandy wrote: Hi All. I have to create a mail merge button which when clicked will merge specific selected feilds from a word document and create a label tag. I want to know if this can be automated and done. Ideally the user should be prompted for what to enter and based on his input the values should be displayed as a label. Thanks for your help in advance. |
#5
|
|||
|
|||
help with macros
Hello Doug,
Thanks for your reply. I have gone through the Auto Form document and would require some help. Bear with me I am not very good at macros and dont totally understand the concept of bookmark. If I am not wrong Bookmark gives you the location of each feild typed in. With my limited knowlege i have created a form which has input text feilds to store information of the user. I am attempting to extract these values. I have named each text box form feild with a book mark. PROJECT DESCRIPTION : [ ] COMPONENT [ ] MPI NO [ ] DRAWING# [ ] REV NO [ ] ASSEMBLY DWG [ ] TOT QTY [ ] each square bracket representing a text form feild with bookmarks for each feild. Now how to extract the values for these once the user inputs them. The order of these entries do not change. Based on the entries i have to create a product tag for merging labels. Is this possible. How do i proceed from here. "Doug Robbins - Word MVP" wrote: You would have to advise how the data is arranged in the reports, is the data always arranged in that way, etc. before anyone could suggest a macro to you. You might want to think however about designing the reports so that the data extraction is facilitated. See http://www.mousetrax.com/techpage.html#autoforms -- 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 "vandy" wrote in message ... Hi Graham, Yes you are right. I need to extract specific field values from a word document and create a label tag out of it. I have an inspection report which has project data like Project desc, project no, Component desc, Dwg no input. I have to extract this information and create a product tag. Is this possible. I am not very good at macros. So any macro example which extracts data to print will be of immense help. Thanks in advance. "Graham Mayor" wrote: This doesn't sound much like a merge to me? You appear to want to extract information from a document and create a label from that information? That being the case, what is the information and how will the macro recognize it from the document? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org vandy wrote: Hi All. I have to create a mail merge button which when clicked will merge specific selected feilds from a word document and create a label tag. I want to know if this can be automated and done. Ideally the user should be prompted for what to enter and based on his input the values should be displayed as a label. Thanks for your help in advance. |
#6
|
|||
|
|||
help with macros
http://gregmaxey.mvps.org/Extract_Form_Data.htm will show you how to extract
data from a form, however, if the object of the exercise is for a user to input data into the form and produce a label, then the following macro will do that (with certain provisos) Sub GetContent() Dim f1, f2, f3, f4, f5, f6, f7, sLayout As String Dim iC, iR As Integer Dim bProtected As Boolean 'Unprotect the file If ActiveDocument.ProtectionType wdNoProtection Then bProtected = True ActiveDocument.Unprotect Password:="" End If 'Get the field content f1 = ActiveDocument.FormFields("Text1").Result f2 = ActiveDocument.FormFields("Text2").Result f3 = ActiveDocument.FormFields("Text3").Result f4 = ActiveDocument.FormFields("Text4").Result f5 = ActiveDocument.FormFields("Text5").Result f6 = ActiveDocument.FormFields("Text6").Result f7 = ActiveDocument.FormFields("Text7").Result 'assemble the content with associated text sLayout = "PRODUCT DESCRIPTION " & f1 & " COMPONENT " & f2 _ & vbCr & "MPI No " & f3 & " DRAWING# " & f4 _ & " REV NO " & f5 & " ASSEMBLY DWG " & f6 _ & vbCr & "TOT QTY " & f7 'Choose the label position Rows: iR = InputBox("Print label on which row?", "Labels Row", 1) If iR 7 Then 'edit number to match label stock MsgBox "There are only seven rows!", vbCritical, "Label Rows" GoTo Rows: End If Columns: iC = InputBox("Print label in which column?", "Labels Column", 1) If iR 2 Then 'edit number to match label stock MsgBox "There are only 2 columns!", vbCritical, "Label Columns" GoTo Columns: End If 'Print the label Application.MailingLabel.PrintOut Name:="AE (2x7)", Address:=sLayout, _ ExtractAddress:=False, SingleLabel:=True, _ Row:=iR, Column:=iC 'Reprotect the document. If bProtected = True Then ActiveDocument.Protect _ Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="" End If End Sub http://www.gmayor.com/installing_macro.htm The label pattern - here a custom label on my PC is AE (2x7) This name must be changed to match the label format you are using. To get the correct label name record a macro of printing anything to that label format and extract the name from the resulting macro. That label must be large enough to fit the text as shown in the message prompt. Edit the macro to match your label format (rows and columns) The fieldnames shown in f1 to f7 are the default names. If you have named the field bookmarks differently to give more meaningful descriptions, you will have to change the bookmark names Text1-7 -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org vandy wrote: Hello Doug, Thanks for your reply. I have gone through the Auto Form document and would require some help. Bear with me I am not very good at macros and dont totally understand the concept of bookmark. If I am not wrong Bookmark gives you the location of each feild typed in. With my limited knowlege i have created a form which has input text feilds to store information of the user. I am attempting to extract these values. I have named each text box form feild with a book mark. PROJECT DESCRIPTION : [ ] COMPONENT [ ] MPI NO [ ] DRAWING# [ ] REV NO [ ] ASSEMBLY DWG [ ] TOT QTY [ ] each square bracket representing a text form feild with bookmarks for each feild. Now how to extract the values for these once the user inputs them. The order of these entries do not change. Based on the entries i have to create a product tag for merging labels. Is this possible. How do i proceed from here. "Doug Robbins - Word MVP" wrote: You would have to advise how the data is arranged in the reports, is the data always arranged in that way, etc. before anyone could suggest a macro to you. You might want to think however about designing the reports so that the data extraction is facilitated. See http://www.mousetrax.com/techpage.html#autoforms -- 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 "vandy" wrote in message ... Hi Graham, Yes you are right. I need to extract specific field values from a word document and create a label tag out of it. I have an inspection report which has project data like Project desc, project no, Component desc, Dwg no input. I have to extract this information and create a product tag. Is this possible. I am not very good at macros. So any macro example which extracts data to print will be of immense help. Thanks in advance. "Graham Mayor" wrote: This doesn't sound much like a merge to me? You appear to want to extract information from a document and create a label from that information? That being the case, what is the information and how will the macro recognize it from the document? -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org vandy wrote: Hi All. I have to create a mail merge button which when clicked will merge specific selected feilds from a word document and create a label tag. I want to know if this can be automated and done. Ideally the user should be prompted for what to enter and based on his input the values should be displayed as a label. Thanks for your help in advance. |
Thread Tools | |
Display Modes | |
|
|