thedark123
06-11-2006, 11:13 PM
I need to do a macro to copy some worksheet information to a new word document:
This is what I will do for my script:
1)When I click on a button in excel, a popup-box will appear and I can specify the directory or location of where my files is (In this case it is a .xls file inside a folder, lets call it 'test'
C:\Documents and Settings\Administrator\Desktop\test)
http://i6.photobucket.com/albums/y226/thedark123/directory.gif
2 )After specifying the directory, immediately a new folder will be created inside 'test' folder depending on that .xls file, If the .xls file is call "CU Maintain Addressee Test Data V0.01.000.xls" then the folder will have the same name as it "CU Maintain Addressee Test Data V0.01.000"
3)Now the script will continue into opening that .xls file (suppose to have a loop to read more .xls files if there are more then 1 of such kind of file in 'test' folder) and read the information in the selected cells and copy it into a new word document.
The new word document will then appear in "C:\Documents and Settings\Administrator\Desktop\test\CU Maintain Addressee Test Data V0.01.000". This process will carry on if there are more of such kind of .xls file. In the new word document there will be a format inside which all subsequent page will follow. The values copied from excel are supposed to fall into the correct table cell in word.
http://i6.photobucket.com/albums/y226/thedark123/exceltable.gif
copied over to
http://i6.photobucket.com/albums/y226/thedark123/wordformat.gif
So in this word document, this format/template already exist, how to corresponse the information from excel cells to word document cells?
4)After everything have been done properly a pop-out box will appear, "Process have been completed successfully"
5)End
This is what I will do for my script:
1)When I click on a button in excel, a popup-box will appear and I can specify the directory or location of where my files is (In this case it is a .xls file inside a folder, lets call it 'test'
C:\Documents and Settings\Administrator\Desktop\test)
http://i6.photobucket.com/albums/y226/thedark123/directory.gif
2 )After specifying the directory, immediately a new folder will be created inside 'test' folder depending on that .xls file, If the .xls file is call "CU Maintain Addressee Test Data V0.01.000.xls" then the folder will have the same name as it "CU Maintain Addressee Test Data V0.01.000"
3)Now the script will continue into opening that .xls file (suppose to have a loop to read more .xls files if there are more then 1 of such kind of file in 'test' folder) and read the information in the selected cells and copy it into a new word document.
The new word document will then appear in "C:\Documents and Settings\Administrator\Desktop\test\CU Maintain Addressee Test Data V0.01.000". This process will carry on if there are more of such kind of .xls file. In the new word document there will be a format inside which all subsequent page will follow. The values copied from excel are supposed to fall into the correct table cell in word.
http://i6.photobucket.com/albums/y226/thedark123/exceltable.gif
copied over to
http://i6.photobucket.com/albums/y226/thedark123/wordformat.gif
So in this word document, this format/template already exist, how to corresponse the information from excel cells to word document cells?
4)After everything have been done properly a pop-out box will appear, "Process have been completed successfully"
5)End