Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code does not work
Hello,
I have inserted these VBA in the module, but the text in T2 does not blink. Did I miss something? Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code does not work
Works fine for me Frank. Did you put the workbook event procedures in
ThisWorkbook? -- __________________________________ HTH Bob "Frank Situmorang" wrote in message ... Hello, I have inserted these VBA in the module, but the text in T2 does not blink. Did I miss something? Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code does not work
No I didn't Phillip, I do not even know where is workbook event procedures .
Could you tell me? -- H. Frank Situmorang "Bob Phillips" wrote: Works fine for me Frank. Did you put the workbook event procedures in ThisWorkbook? -- __________________________________ HTH Bob "Frank Situmorang" wrote in message ... Hello, I have inserted these VBA in the module, but the text in T2 does not blink. Did I miss something? Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code does not work
Near the bottom of the code that you posted you will read
'Then, in the ThisWorkbook code module of the workbook, use code like: Each VBA project consists of various objects, worksheets, modules and ThisWorkbook. Copy that code to there. -- __________________________________ HTH Bob "Frank Situmorang" wrote in message ... No I didn't Phillip, I do not even know where is workbook event procedures . Could you tell me? -- H. Frank Situmorang "Bob Phillips" wrote: Works fine for me Frank. Did you put the workbook event procedures in ThisWorkbook? -- __________________________________ HTH Bob "Frank Situmorang" wrote in message ... Hello, I have inserted these VBA in the module, but the text in T2 does not blink. Did I miss something? Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code does not work
I already copied that Phil, exactly like the VBA I mentioned. Maybe somthing
I missed. Application.OnTime RunWhen, "'" & ThisWorkbook.Name Waht is this: "'" , should it be filled in the middle? -- H. Frank Situmorang "Frank Situmorang" wrote: Hello, I have inserted these VBA in the module, but the text in T2 does not blink. Did I miss something? Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code does not work
The code requires no alterations, it's correct. If your confident you've put
all the code where it should be, did you save, close and re-open the workbook? Mike "Frank Situmorang" wrote: I already copied that Phil, exactly like the VBA I mentioned. Maybe somthing I missed. Application.OnTime RunWhen, "'" & ThisWorkbook.Name Waht is this: "'" , should it be filled in the middle? -- H. Frank Situmorang "Frank Situmorang" wrote: Hello, I have inserted these VBA in the module, but the text in T2 does not blink. Did I miss something? Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code does not work
This is exactly what I copied Mike, and I saved and opened it, but it is
still not blinking. I am using excel2007. So while open my workbook. I go to toolbar developer than clicked VBA code, then I copied, saved and reopend still nothing happend Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang "Mike H" wrote: The code requires no alterations, it's correct. If your confident you've put all the code where it should be, did you save, close and re-open the workbook? Mike "Frank Situmorang" wrote: I already copied that Phil, exactly like the VBA I mentioned. Maybe somthing I missed. Application.OnTime RunWhen, "'" & ThisWorkbook.Name Waht is this: "'" , should it be filled in the middle? -- H. Frank Situmorang "Frank Situmorang" wrote: Hello, I have inserted these VBA in the module, but the text in T2 does not blink. Did I miss something? Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code does not work
Thanks to all of you, it works now for me, the 2nd part should have been
copied to the proper place. -- H. Frank Situmorang "Mike H" wrote: The code requires no alterations, it's correct. If your confident you've put all the code where it should be, did you save, close and re-open the workbook? Mike "Frank Situmorang" wrote: I already copied that Phil, exactly like the VBA I mentioned. Maybe somthing I missed. Application.OnTime RunWhen, "'" & ThisWorkbook.Name Waht is this: "'" , should it be filled in the middle? -- H. Frank Situmorang "Frank Situmorang" wrote: Hello, I have inserted these VBA in the module, but the text in T2 does not blink. Did I miss something? Public RunWhen As Double Sub StartBlink() With ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font If .ColorIndex = 3 Then ' Red Text .ColorIndex = 2 ' White Text Else .ColorIndex = 3 ' Red Text End If End With RunWhen = Now + TimeSerial(0, 0, 1) Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , True End Sub Sub StopBlink() ThisWorkbook.Worksheets("PO_Line_text").Range("T2" ).Font.ColorIndex = _ xlColorIndexAutomatic Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink", , False End Sub 'Then, in the ThisWorkbook code module of the workbook, use code like: Private Sub Workbook_Open() StartBlink End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) StopBlink End Sub -- H. Frank Situmorang |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code just won't work... | Excel Programming | |||
Why doesn't ths VBA Code work? | Excel Programming | |||
Why Won't This Code Work???? | Excel Programming | |||
Help getting code to work. | Excel Programming | |||
Why my code do not work : - ( | Excel Programming |