![]() |
Move Worksheet from one Workbool to another - fails on Excel 2007
A macro I used on Excel 2003 has stopped working now I am on Excel 2007.
I open a text files as a workbook then copy that sheet (the only sheet) into another workbook which has been opened from a template, this way I am combining the raw data i need in a text file with the formatting/macros I need in the template workbook. Here is the code Dim xl As Excel.Application Dim wbkCode As Excel.Workbook Dim wbkTemp As Excel.Workbook Set wbkTemp = xl.Workbooks.Open(filename:=strTempFullPath) Set wbkCode = xl.Workbooks.Open(filename:=strWorkBookName) wbkTemp.Workheets(1).Move befo=wbkCode.Worksheets(1) the third line gives no errors, but adds no work sheets to wbkCode. I can't use a range copy and paste as the text file can be extremely large, right up to the limits of Excel's capacity, so the worksheet has to be moved as an object as above. Any help greatly appreciated! |
Move Worksheet from one Workbool to another - fails on Excel 2007
Could a moderator change the spelling in the thread title for Workbook?
"Mark Leonard" wrote: A macro I used on Excel 2003 has stopped working now I am on Excel 2007. I open a text files as a workbook then copy that sheet (the only sheet) into another workbook which has been opened from a template, this way I am combining the raw data i need in a text file with the formatting/macros I need in the template workbook. Here is the code Dim xl As Excel.Application Dim wbkCode As Excel.Workbook Dim wbkTemp As Excel.Workbook Set wbkTemp = xl.Workbooks.Open(filename:=strTempFullPath) Set wbkCode = xl.Workbooks.Open(filename:=strWorkBookName) wbkTemp.Workheets(1).Move befo=wbkCode.Worksheets(1) the third line gives no errors, but adds no work sheets to wbkCode. I can't use a range copy and paste as the text file can be extremely large, right up to the limits of Excel's capacity, so the worksheet has to be moved as an object as above. Any help greatly appreciated! |
Move Worksheet from one Workbool to another - fails on Excel 2007
Could a moderator change the spelling in the thread title for Workbook?
There is no moderator. -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Mark Leonard" wrote in message ... Could a moderator change the spelling in the thread title for Workbook? "Mark Leonard" wrote: A macro I used on Excel 2003 has stopped working now I am on Excel 2007. I open a text files as a workbook then copy that sheet (the only sheet) into another workbook which has been opened from a template, this way I am combining the raw data i need in a text file with the formatting/macros I need in the template workbook. Here is the code Dim xl As Excel.Application Dim wbkCode As Excel.Workbook Dim wbkTemp As Excel.Workbook Set wbkTemp = xl.Workbooks.Open(filename:=strTempFullPath) Set wbkCode = xl.Workbooks.Open(filename:=strWorkBookName) wbkTemp.Workheets(1).Move befo=wbkCode.Worksheets(1) the third line gives no errors, but adds no work sheets to wbkCode. I can't use a range copy and paste as the text file can be extremely large, right up to the limits of Excel's capacity, so the worksheet has to be moved as an object as above. Any help greatly appreciated! |
All times are GMT +1. The time now is 10:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com