![]() |
How to position to a specific sheet before saving
I'm creating an Excel workbook from VB6 that contains exported SQL Server
data. The workbook can contain more than one sheet - when I'm ready to save it, how can I reposition to the first sheet? I've tried the following code, but when re-opening the workbook it opens to the last sheet created: Set oSheet = oWB.Worksheets(1) oWB.SaveAs (msExcelPath & msExcelFileName) Any help would be appreciated. Thanks! |
How to position to a specific sheet before saving
Try...
Set oSheet = oWB.Worksheets(1) oSheet.Select oWB.SaveAs (msExcelPath & msExcelFileName) -- HTH... Jim Thomlinson "Pete Kipe" wrote: I'm creating an Excel workbook from VB6 that contains exported SQL Server data. The workbook can contain more than one sheet - when I'm ready to save it, how can I reposition to the first sheet? I've tried the following code, but when re-opening the workbook it opens to the last sheet created: Set oSheet = oWB.Worksheets(1) oWB.SaveAs (msExcelPath & msExcelFileName) Any help would be appreciated. Thanks! |
How to position to a specific sheet before saving
Many thanks, Jim. Works perfectly now. Pete
"Jim Thomlinson" wrote: Try... Set oSheet = oWB.Worksheets(1) oSheet.Select oWB.SaveAs (msExcelPath & msExcelFileName) -- HTH... Jim Thomlinson "Pete Kipe" wrote: I'm creating an Excel workbook from VB6 that contains exported SQL Server data. The workbook can contain more than one sheet - when I'm ready to save it, how can I reposition to the first sheet? I've tried the following code, but when re-opening the workbook it opens to the last sheet created: Set oSheet = oWB.Worksheets(1) oWB.SaveAs (msExcelPath & msExcelFileName) Any help would be appreciated. Thanks! |
All times are GMT +1. The time now is 05:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com