View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Paul J.[_2_] Paul J.[_2_] is offline
external usenet poster
 
Posts: 1
Default ScreenUpdating function not working?

I'm using Office 2003 on Win XP Pro SP2, Dell PC. I have the following vba
script in a spreadsheet, and I want to hide all the activity.. but the
ScreenUpdating function doesn't seem to be hiding anything, tons of stuff
still shows on screen. (Note: I just added in all the comments to this
screen for readability, in my code they aren't there.) And please don't
laugh that I'm using SendKeys statements, it was quick and I'm not a
programmer. Thanks.
-----------------------------------------

Private Sub cmdApp_Click()

' Turn off Screen Updating
Application.ScreenUpdating = False

' Unprotect the worksheet
Excel.SendKeys ("%(t)")
Excel.SendKeys ("p")
Excel.SendKeys ("p")
Excel.SendKeys ("excel")
Excel.SendKeys ("{ENTER}")

' Goto Cell A22
Excel.SendKeys ("{F5}")
Excel.SendKeys ("{DELETE}")
Excel.SendKeys ("A22")
Excel.SendKeys ("{ENTER}")

' Select current row and next 7 rows
Excel.SendKeys ("+({DOWN 7})")

' Insert a bunch of rows
Excel.SendKeys ("%(i)")
Excel.SendKeys ("r")

' Move cursor down 1 row
Excel.SendKeys ("{DOWN}")

' Format row height then go to next row
Excel.SendKeys ("%(o)re12.75{ENTER}")
Excel.SendKeys ("{DOWN}")

' Format row height then go to next row
Excel.SendKeys ("%(o)re3.75{ENTER}")
Excel.SendKeys ("{DOWN}")

' Format row height then go to next row
Excel.SendKeys ("%(o)re12.75{ENTER}")
Excel.SendKeys ("{DOWN}")

' Format row height then go to next row
Excel.SendKeys ("%(o)re3.75{ENTER}")
Excel.SendKeys ("{DOWN}")

' Format row height then go to next row
Excel.SendKeys ("%(o)re12.75{ENTER}")
Excel.SendKeys ("{DOWN}")

' Format row height then go to next row
Excel.SendKeys ("%(o)re12.75{ENTER}")
Excel.SendKeys ("{DOWN}")

' Format row height then go to next row
Excel.SendKeys ("%(o)re2.50{ENTER}")
Excel.SendKeys ("{DOWN}")

' Insert another row
Excel.SendKeys ("%(i)")
Excel.SendKeys ("r")

' Move cursor two cells to the right
Excel.SendKeys ("{RIGHT 2}")

' Select 6 columns wide (blank row that was just inserted)
Excel.SendKeys ("+({RIGHT 6})")

' Format cell pattern to be solid black
Excel.SendKeys ("%(o)ebp{TAB}{DOWN}{ENTER}{TAB 2}{ENTER}")

' Go down two rows
Excel.SendKeys ("{DOWN 2}")

' Select 3 columns and 4 rows
Excel.SendKeys ("+({RIGHT 3}{DOWN 4})")

' Copy selected rows
Excel.SendKeys ("^(c)")

' Move curser up 9 rows
Excel.SendKeys ("{UP 9}")

' Paste rows from previous copy then ESC out of copy sequence
Excel.SendKeys ("^(v)")
Excel.SendKeys ("{ESC}")

' Move right one cell, delete its contents
Excel.SendKeys ("{RIGHT}")
Excel.SendKeys ("{DELETE}")

' Move right two cells, delete its contents
Excel.SendKeys ("{RIGHT 2}")
Excel.SendKeys ("{DELETE}")

' Move down 2 and left 1 cell, delete its contents
Excel.SendKeys ("{DOWN 2}{LEFT}{DELETE}")

' Move down 2 cells, delete its contents
Excel.SendKeys ("{DOWN 2}{DELETE}")

' Move up 4 cells and left 1 cell
Excel.SendKeys ("{UP 4}{LEFT}")

' Re-protect the worksheet
Excel.SendKeys ("%(t)pp")
Excel.SendKeys ("excel")
Excel.SendKeys ("{ENTER}")
Excel.SendKeys ("excel")
Excel.SendKeys ("{ENTER}")

' Turn Screen Updating back on
Application.ScreenUpdating = True

End Sub

~ Paul