#1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Code Error

I have this code (below) and when I run from Macro a window appears and say
(file could not be found. Check the spelling of the file name, and verify
that the file location is correct). How can I solve this problem.

Thanks

This is the code:

Public RunWhen As Double

Sub StartBlink()
With ThisWorkbook.Worksheets("AAA").Range("AG3").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 & "'!StartBlink3", ,
True
End Sub

Sub StopBlink()
ThisWorkbook.Worksheets("AAA").Range("AG3").Font.C olorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink3", ,
False
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Code Error

hi
your main sub is startblink but your ontime is trying to run startblink3.
post startblink3 sub.

Regards
FSt1

"MAX" wrote:

I have this code (below) and when I run from Macro a window appears and say
(file could not be found. Check the spelling of the file name, and verify
that the file location is correct). How can I solve this problem.

Thanks

This is the code:

Public RunWhen As Double

Sub StartBlink()
With ThisWorkbook.Worksheets("AAA").Range("AG3").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 & "'!StartBlink3", ,
True
End Sub

Sub StopBlink()
ThisWorkbook.Worksheets("AAA").Range("AG3").Font.C olorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink3", ,
False
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Code Error

You should not need the workbook(file) name the procedure is in the same
workbook that calls it.

Public RunWhen As Double

Sub StartBlink()
With ThisWorkbook.Worksheets("AAA").Range("AG3").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, "StartBlink3", , True
End Sub

Sub StopBlink()
ThisWorkbook.Worksheets("AAA").Range("AG3").Font.C olorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "StartBlink3", , False
End Sub


"MAX" wrote in message
...
I have this code (below) and when I run from Macro a window appears and say
(file could not be found. Check the spelling of the file name, and verify
that the file location is correct). How can I solve this problem.

Thanks

This is the code:

Public RunWhen As Double

Sub StartBlink()
With ThisWorkbook.Worksheets("AAA").Range("AG3").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 & "'!StartBlink3",
,
True
End Sub

Sub StopBlink()
ThisWorkbook.Worksheets("AAA").Range("AG3").Font.C olorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink3",
,
False
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 390
Default Code Error

It was Sub StartBlink3, I had a mistake.

"FSt1" wrote:

hi
your main sub is startblink but your ontime is trying to run startblink3.
post startblink3 sub.

Regards
FSt1

"MAX" wrote:

I have this code (below) and when I run from Macro a window appears and say
(file could not be found. Check the spelling of the file name, and verify
that the file location is correct). How can I solve this problem.

Thanks

This is the code:

Public RunWhen As Double

Sub StartBlink()
With ThisWorkbook.Worksheets("AAA").Range("AG3").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 & "'!StartBlink3", ,
True
End Sub

Sub StopBlink()
ThisWorkbook.Worksheets("AAA").Range("AG3").Font.C olorIndex = _
xlColorIndexAutomatic
Application.OnTime RunWhen, "'" & ThisWorkbook.Name & "'!StartBlink3", ,
False
End Sub

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
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... Corey Excel Programming 4 November 25th 06 04:57 AM
OnTime code error "can't execute code in break mode" tskogstrom Excel Programming 1 September 8th 06 10:29 AM
Error in Excel VBA Code (Error 91) dailem Excel Programming 1 August 25th 06 03:45 PM
How can I still go to the error-code after a On Error Goto? Michel[_3_] Excel Programming 2 May 4th 04 04:21 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


All times are GMT +1. The time now is 07:18 AM.

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"