Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generate Data sheets from Template

Status
Not open for further replies.

cherry2000

Electrical
Jun 21, 2007
99
I need to generate Data sheets using a Template filled with some generic and some customised information. The customised information is filled in a seperate Database file with a file name. The customised data field is also highlighted in red in the database. Now all the macro needs to do is :

(initially user opens both the sheets..template + database)
1. search and replace all the red fields with data taken from the database
2. save the file using the filename given in the database
3. again repeat the process for the next row of data in the Database

I am attaching both the sample files, for reference.

If somebody can help with the Macro, I will be grateful.

This will be great tool for generating multiple data sheets.
 
Replies continue below

Recommended for you

If your Templates were done in Word you could use Word's Mail Merge facilities
 
Here is a macro for you. I changed one thing in the sample sheet, the MCC tag has its own cell. I found it easier to paste it into its own cell rather than appending it to the end of a cell. Before you run the macro you will have to change a few file paths (they are commented in the macro). The macro is stored in the database file, press 'alt' + 'F11' to open the editor.
 
 http://files.engineering.com/getfile.aspx?folder=a085e314-d270-4d2e-bd36-55ccfa36c2ea&file=macro.zip
Hi Cowski.. I just executed a trial run for the Macro with corrected file paths, and it works like a charm!! Thanks a lot!! This can be very useful for many other users.
 
I've done a little editting to the macro. I don't know if this would be a problem, but the original macro kept all of the new spreadsheets open. I also changed how everything was copied (i.e., instead of doing a simple copy - paste and going back and forth between the files, I created strings for each of the items and only went back & forth once.)
 
 http://files.engineering.com/getfile.aspx?folder=84e92648-357c-4252-948e-a310750f6e92&file=Database.zip
Good additions, zelgar.

I should have mentioned in my previous post that there is plenty of room for improvement and some error checking is probably needed.
 
First, I noticed a slight error in my last version of the macros. The directory commands didn't always work.

I also noticed that the current versions would want to replace the existing created files. This can be fixed by either deleting the current data in the database or by changing the starting row. Attached are 2 different versions that would fix this problem.
 
 http://files.engineering.com/getfile.aspx?folder=3a2c0e5b-ccaf-470f-a40f-d5ae521d3798&file=revised_database.zip
I must say thanks to all of you..the Macro works..and it should be a very useful tool, if Data sheets with say 95% generic data and remaining custized data is required to be generated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor