marcley467
New Member
- Joined
- Oct 13, 2015
- Messages
- 7
Hi, I was hoping someone could help me with a VBA code that would combine text and data from excel to a word document. I have unsuccessfully modified & combined code from examples I have found online, and would appreciate any help you can provide. If possible, could you please add comments to the code?
Details:
Excel Document:
Log to Track Non-Conforming product. Each row is a separate entry.
The log consists of multiple columns….(header are: Date, Initiator, Part number, Lot, Qty, Issue, etc.. / Not all data in the row will need to be included within the word document.)
Additional Text:
Additional text is added both before and after the excel data.
Word Document:
A report is created from the combined info.
If possible, I would like the user to click a command button that would automatically combine the text, data from excel, and optional text.
Formatting/placement of info just aligns to the left margin.
A return would separate the paragraphs/excel data.
I would like the code to:
I am new to this forum and am unsure how to include an example or document but I would be happy to provide any additional info needed. Any help would be greatly appreciated.
Thank you & happy holidays
Details:
Excel Document:
Log to Track Non-Conforming product. Each row is a separate entry.
The log consists of multiple columns….(header are: Date, Initiator, Part number, Lot, Qty, Issue, etc.. / Not all data in the row will need to be included within the word document.)
Additional Text:
Additional text is added both before and after the excel data.
- 2 standard paragraphs (that never change) are above the excel data
- 3 optional paragraphs, depending upon the disposition of the parts…
- The 3 optional requirements are: RMA, Credit, and Replacements.
- 2 additional standard paragraphs below the optional text.
Word Document:
A report is created from the combined info.
If possible, I would like the user to click a command button that would automatically combine the text, data from excel, and optional text.
Formatting/placement of info just aligns to the left margin.
A return would separate the paragraphs/excel data.
I would like the code to:
- Create new word document
- Add beginning (2) paragraphs
- Add excel data: The data exported from excel would be pulled from certain columns in a selected row. The row would be selected by clicking on a predefined cell…
- For example: the 2nd cell within a row. If the defined cell is not selected, a prompt would ask you to select a row.
- Add Optional text: The user would receive a y/n prompt for each of the 3 optional requirements. RMA, Credit, and Replacements. For example: Prompt could be a y/n message asking “Do you want to request an “RMA”?. If yes is selected the paragraph requesting an RMA would be added. If no, it would go to the next optional requirement.
- Add ending paragraph
I am new to this forum and am unsure how to include an example or document but I would be happy to provide any additional info needed. Any help would be greatly appreciated.
Thank you & happy holidays