![]() |
Combining multiple Excel files into one html?
I am using Office 2003 on Windows XP.
Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. |
Combining multiple Excel files into one html?
Turn on the macro recorder
open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. |
Combining multiple Excel files into one html?
Thanks Tom.
The files will be coming to me from different sources already saved in HTML format. Although I could have the users send me the Excel files instead, each one page document contains a different number of columns and column widths making combining them in Excel difficult at best. It could be done I suppose by copying a picture of each, but then I'm faced with combining and aligning the graphics, etc. Ultimately it all needs to be converted to HTML and I just thought if there were a way to just combine them (stack them one above the other in the right order) using VBA it might shortcut the process. Any other ideas or suggestions? "Tom Ogilvy" wrote: Turn on the macro recorder open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. |
Combining multiple Excel files into one html?
All the problems you listed would be inherent in stacking them. Just use
the DOS copy command to append them. -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks Tom. The files will be coming to me from different sources already saved in HTML format. Although I could have the users send me the Excel files instead, each one page document contains a different number of columns and column widths making combining them in Excel difficult at best. It could be done I suppose by copying a picture of each, but then I'm faced with combining and aligning the graphics, etc. Ultimately it all needs to be converted to HTML and I just thought if there were a way to just combine them (stack them one above the other in the right order) using VBA it might shortcut the process. Any other ideas or suggestions? "Tom Ogilvy" wrote: Turn on the macro recorder open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. |
Combining multiple Excel files into one html?
Thanks again Tom, I was delving into an area in which I had no experience so
I didn't know if it would be easier or not. But now you've brought up a new issue. I've used the DOS command to copy files, but how can it be used to append? Sorry, but I need some help on this one too... "Tom Ogilvy" wrote: All the problems you listed would be inherent in stacking them. Just use the DOS copy command to append them. -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks Tom. The files will be coming to me from different sources already saved in HTML format. Although I could have the users send me the Excel files instead, each one page document contains a different number of columns and column widths making combining them in Excel difficult at best. It could be done I suppose by copying a picture of each, but then I'm faced with combining and aligning the graphics, etc. Ultimately it all needs to be converted to HTML and I just thought if there were a way to just combine them (stack them one above the other in the right order) using VBA it might shortcut the process. Any other ideas or suggestions? "Tom Ogilvy" wrote: Turn on the macro recorder open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. |
Combining multiple Excel files into one html?
copy a.htm + b.htm + c.htm d.htm
should append a,b,c to a new file d -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks again Tom, I was delving into an area in which I had no experience so I didn't know if it would be easier or not. But now you've brought up a new issue. I've used the DOS command to copy files, but how can it be used to append? Sorry, but I need some help on this one too... "Tom Ogilvy" wrote: All the problems you listed would be inherent in stacking them. Just use the DOS copy command to append them. -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks Tom. The files will be coming to me from different sources already saved in HTML format. Although I could have the users send me the Excel files instead, each one page document contains a different number of columns and column widths making combining them in Excel difficult at best. It could be done I suppose by copying a picture of each, but then I'm faced with combining and aligning the graphics, etc. Ultimately it all needs to be converted to HTML and I just thought if there were a way to just combine them (stack them one above the other in the right order) using VBA it might shortcut the process. Any other ideas or suggestions? "Tom Ogilvy" wrote: Turn on the macro recorder open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. |
Combining multiple Excel files into one html?
Got it. Thanks much Tom.
"Tom Ogilvy" wrote: copy a.htm + b.htm + c.htm d.htm should append a,b,c to a new file d -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks again Tom, I was delving into an area in which I had no experience so I didn't know if it would be easier or not. But now you've brought up a new issue. I've used the DOS command to copy files, but how can it be used to append? Sorry, but I need some help on this one too... "Tom Ogilvy" wrote: All the problems you listed would be inherent in stacking them. Just use the DOS copy command to append them. -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks Tom. The files will be coming to me from different sources already saved in HTML format. Although I could have the users send me the Excel files instead, each one page document contains a different number of columns and column widths making combining them in Excel difficult at best. It could be done I suppose by copying a picture of each, but then I'm faced with combining and aligning the graphics, etc. Ultimately it all needs to be converted to HTML and I just thought if there were a way to just combine them (stack them one above the other in the right order) using VBA it might shortcut the process. Any other ideas or suggestions? "Tom Ogilvy" wrote: Turn on the macro recorder open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. |
Combining multiple Excel files into one html?
Tom, I get a compile error using that string, I assumed it was delivered in
the same way as "FileCopy", but obviously not. How do I execute that line of code in VBA? "quartz" wrote: Got it. Thanks much Tom. "Tom Ogilvy" wrote: copy a.htm + b.htm + c.htm d.htm should append a,b,c to a new file d -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks again Tom, I was delving into an area in which I had no experience so I didn't know if it would be easier or not. But now you've brought up a new issue. I've used the DOS command to copy files, but how can it be used to append? Sorry, but I need some help on this one too... "Tom Ogilvy" wrote: All the problems you listed would be inherent in stacking them. Just use the DOS copy command to append them. -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks Tom. The files will be coming to me from different sources already saved in HTML format. Although I could have the users send me the Excel files instead, each one page document contains a different number of columns and column widths making combining them in Excel difficult at best. It could be done I suppose by copying a picture of each, but then I'm faced with combining and aligning the graphics, etc. Ultimately it all needs to be converted to HTML and I just thought if there were a way to just combine them (stack them one above the other in the right order) using VBA it might shortcut the process. Any other ideas or suggestions? "Tom Ogilvy" wrote: Turn on the macro recorder open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. |
Combining multiple Excel files into one html?
One way:
Option Explicit Sub testme() Dim myFileNames As String Dim myFolder As String myFolder = "c:\my documents\excel\test\" myFileNames = "*.htm" Shell Environ("comspec") & " /k copy /b " _ & Chr(34) & myFolder & myFileNames & Chr(34) & " " _ & Chr(34) & myFolder & "AllTemp.txt" & Chr(34), _ vbMinimizedNoFocus 'wait 2 seconds for copy to finish Application.Wait Now + TimeSerial(0, 0, 2) On Error Resume Next Kill myFolder & "all.htm" On Error GoTo 0 Name myFolder & "alltemp.txt" As myFolder & "all.htm" End Sub Change the /k to /c to dismiss that DOS window when it's done. It copies all the *.htm files in the folder to a new file named all.htm. Actually, it copies all of them into a file called alltemp.txt, then renames that file to all.htm. quartz wrote: Tom, I get a compile error using that string, I assumed it was delivered in the same way as "FileCopy", but obviously not. How do I execute that line of code in VBA? "quartz" wrote: Got it. Thanks much Tom. "Tom Ogilvy" wrote: copy a.htm + b.htm + c.htm d.htm should append a,b,c to a new file d -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks again Tom, I was delving into an area in which I had no experience so I didn't know if it would be easier or not. But now you've brought up a new issue. I've used the DOS command to copy files, but how can it be used to append? Sorry, but I need some help on this one too... "Tom Ogilvy" wrote: All the problems you listed would be inherent in stacking them. Just use the DOS copy command to append them. -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks Tom. The files will be coming to me from different sources already saved in HTML format. Although I could have the users send me the Excel files instead, each one page document contains a different number of columns and column widths making combining them in Excel difficult at best. It could be done I suppose by copying a picture of each, but then I'm faced with combining and aligning the graphics, etc. Ultimately it all needs to be converted to HTML and I just thought if there were a way to just combine them (stack them one above the other in the right order) using VBA it might shortcut the process. Any other ideas or suggestions? "Tom Ogilvy" wrote: Turn on the macro recorder open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. -- Dave Peterson |
Combining multiple Excel files into one html?
Thanks a lot Dave. You nailed it! I really appreciate it.
"Dave Peterson" wrote: One way: Option Explicit Sub testme() Dim myFileNames As String Dim myFolder As String myFolder = "c:\my documents\excel\test\" myFileNames = "*.htm" Shell Environ("comspec") & " /k copy /b " _ & Chr(34) & myFolder & myFileNames & Chr(34) & " " _ & Chr(34) & myFolder & "AllTemp.txt" & Chr(34), _ vbMinimizedNoFocus 'wait 2 seconds for copy to finish Application.Wait Now + TimeSerial(0, 0, 2) On Error Resume Next Kill myFolder & "all.htm" On Error GoTo 0 Name myFolder & "alltemp.txt" As myFolder & "all.htm" End Sub Change the /k to /c to dismiss that DOS window when it's done. It copies all the *.htm files in the folder to a new file named all.htm. Actually, it copies all of them into a file called alltemp.txt, then renames that file to all.htm. quartz wrote: Tom, I get a compile error using that string, I assumed it was delivered in the same way as "FileCopy", but obviously not. How do I execute that line of code in VBA? "quartz" wrote: Got it. Thanks much Tom. "Tom Ogilvy" wrote: copy a.htm + b.htm + c.htm d.htm should append a,b,c to a new file d -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks again Tom, I was delving into an area in which I had no experience so I didn't know if it would be easier or not. But now you've brought up a new issue. I've used the DOS command to copy files, but how can it be used to append? Sorry, but I need some help on this one too... "Tom Ogilvy" wrote: All the problems you listed would be inherent in stacking them. Just use the DOS copy command to append them. -- Regards, Tom Ogilvy "quartz" wrote in message ... Thanks Tom. The files will be coming to me from different sources already saved in HTML format. Although I could have the users send me the Excel files instead, each one page document contains a different number of columns and column widths making combining them in Excel difficult at best. It could be done I suppose by copying a picture of each, but then I'm faced with combining and aligning the graphics, etc. Ultimately it all needs to be converted to HTML and I just thought if there were a way to just combine them (stack them one above the other in the right order) using VBA it might shortcut the process. Any other ideas or suggestions? "Tom Ogilvy" wrote: Turn on the macro recorder open each in excel. Bring the data from workbooks 2 and 3 into workbook 1 using copy and paste. Save as HTML Turn off the macro recorder. Now modify the code to make it a little more dynamic. -- Regards, Tom Ogilvy "quartz" wrote in message ... I am using Office 2003 on Windows XP. Take one Excel file that has been converted (saved as) an HTML document from one user. Take another one from another user, and yet a third one. I need to combine these into one single HTML document programmatically from VBA. Is this possible? I've been looking at previous posts and I don't see anything like this... For the most part the files just contain text and numbers or formulas, but rarely could include a chart or other graphic. If it is possible, could some one please post example code? If it is NOT possible, could someone please enlighten me? Thanks much in advance. -- Dave Peterson |
All times are GMT +1. The time now is 12:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com