ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Why won't this sheet delete? (https://www.excelbanter.com/excel-programming/413475-why-wont-sheet-delete.html)

ragtopcaddy via OfficeKB.com

Why won't this sheet delete?
 
Why doesn't the following code, which runs without any errors, result in the
sheet named being deleted?

Set wkbkRpt = XLobj.Workbooks.Open(strRptPath)
wkbkRpt.Activate
Set shtTmplt = wkbkRpt.Sheets("MarketRpt")
shtTmplt.Delete
wkbkRpt.Worksheets(1).Activate
wkbkRpt.Save

Thanks,

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200807/1


Gary Brown[_4_]

Why won't this sheet delete?
 
Check for spaces in the worksheet such as "MarketRpt ". Unnoticable but is
different from "MarketRpt".
--
Hope this helps.
If this post was helpfull, please remember to click on the ''''YES''''
button at the bottom of the screen.
Thanks,
Gary Brown


"ragtopcaddy via OfficeKB.com" wrote:

Why doesn't the following code, which runs without any errors, result in the
sheet named being deleted?

Set wkbkRpt = XLobj.Workbooks.Open(strRptPath)
wkbkRpt.Activate
Set shtTmplt = wkbkRpt.Sheets("MarketRpt")
shtTmplt.Delete
wkbkRpt.Worksheets(1).Activate
wkbkRpt.Save

Thanks,

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200807/1



TomPl

Why won't this sheet delete?
 
Deleting a worksheet causes an alert message that could be foiling your
attempt. Consider:

Application.DisplayAlerts = False
ThisWorkbook.Worksheets("Sheet3").Delete
Application.DisplayAlerts = True

"ragtopcaddy via OfficeKB.com" wrote:

Why doesn't the following code, which runs without any errors, result in the
sheet named being deleted?

Set wkbkRpt = XLobj.Workbooks.Open(strRptPath)
wkbkRpt.Activate
Set shtTmplt = wkbkRpt.Sheets("MarketRpt")
shtTmplt.Delete
wkbkRpt.Worksheets(1).Activate
wkbkRpt.Save

Thanks,

--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200807/1



ragtopcaddy via OfficeKB.com

Why won't this sheet delete?
 
Thanks fellas!

TomPl wrote:
Deleting a worksheet causes an alert message that could be foiling your
attempt. Consider:

Application.DisplayAlerts = False
ThisWorkbook.Worksheets("Sheet3").Delete
Application.DisplayAlerts = True

Why doesn't the following code, which runs without any errors, result in the
sheet named being deleted?

[quoted text clipped - 7 lines]

Thanks,


--
Bill Reed

"If you can't laugh at yourself, laugh at somebody else"

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200807/1



All times are GMT +1. The time now is 09:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com