Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 65
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code just won't work... Gordon[_2_] Excel Programming 0 July 31st 06 03:32 PM
Why doesn't ths VBA Code work? Mac Lingo[_2_] Excel Programming 1 November 24th 05 02:03 AM
Why Won't This Code Work???? TK[_3_] Excel Programming 2 September 15th 05 08:26 AM
Help getting code to work. Myrna Larson Excel Programming 2 July 29th 04 07:07 AM
Why my code do not work : - ( Tom Ogilvy Excel Programming 1 August 31st 03 04:53 PM


All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"