Help! I need an alternative to "Send Keys"

jreeper

New Member
Joined
Apr 4, 2002
Messages
5
I inherited a number of Excel projects and the previous developer open a workbook and delete all but a few sheets... the Send Keys will often not reach the dialog box in time to accomplish the task. I am looking for a way similar to access to set the warning dialog off and then turning it back on after completion... is there a way?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
I didn't want to use send keys... too difficult to guarantee success... but FYI I found the "Application.DisplayAlerts = False" is what I needed. Thanks
 
Upvote 0
I don't know if you'd be interested, but you don't have to open a worbook to delete sheets from it. This would get rid of the stupid SendKeys command (I have a semi-irrational hatred of that command).

This example will open a workbook in C:Temp called "Book2.xls" it will then delete sheet2 from that workbook, assuming that sheet exists.<pre>
Public Sub main()

Dim XL As Excel.Application
Dim WBK As Excel.Workbook


On Error GoTo ERR_MAIN
Set XL = CreateObject("Excel.Application")
Set WBK = XL.Workbooks.Open("C:TempBook2.xls")

XL.DisplayAlerts = False
WBK.Sheets("Sheet2").Delete
XL.DisplayAlerts = True

ERR_MAIN:
WBK.Close savechanges:=True
Set XL = Nothing

End Sub</pre>

I hope this is of use.

EDIT:: Obviously there are too many backslashes in the path definition, but you can remove those. That's a known bug of this message board.
_________________<font color = green> Mark O'Brien
This message was edited by Mark O'Brien on 2002-04-05 13:32
This message was edited by Mark O'Brien on 2002-04-05 18:07
 
Upvote 0

Forum statistics

Threads
1,213,496
Messages
6,113,993
Members
448,539
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top