How to run a macro by opening a file?
"Eric" wrote in message
...
Thank everyone very much for suggestions
When I insert following codes into my existing file.xls, it cannot run at
all. When I open file.xls, it will request confirmation to activate macro
and
to update all links, after that, it stops without performing anything.
Do you have any suggestions what cause it not running?
Thanks in advance for any suggestions
Eric
Sub Auto_Open()
nameofmacro
End Sub
"Mike" wrote:
"Eric" wrote in message
...
Thank everyone very much for suggestions
I would like to trigger a macro by opening a file.xls, but in your
coding,
I
require to run Workbook_Open macro after a file.xls is opened.
Does anyone have any suggestions on how to trigger macro automatically
by
opening file.xls, where the macro is inside the file.xls.
Does anyone have any suggestions?
Thanks in advance for any suggestions
Eric
"FSt1" wrote:
hi
something like this might work........
Private Sub Workbook_Open()
If Time "9:00 AM" And Time < "10:00 AM" Then
call ASpecificMacro
Else
MsgBox "current time out of range. terminating macro run."
end if
end sub
this would go in the workbook module.
regards
FSt1
"Eric" wrote:
Does anyone have any suggestions on how to run a macro when I open a
file?
For example, I would like to run a specific macro within file.xls,
if
current time is between 9 am and 10 am, otherwise, don't run this
macro.
Does anyone have any suggestions on how to do it? I am using XP with
SP3 and
Office 2003.
Thanks in advance for any suggestions
Eric
You could use this. It is automatically run with the workbook is opened.
You may also have to set this if you are opening the workbook from
another
workbook macro... ActiveWorkbook.RunAutoMacros xlAutoOpen
Sub Auto_Open()
code here
End Sub
Mike
.
You may need to create a digital signature for yourself and then add it from
the tools menu in vba.
Mike
|