I have a workbook which is networked. Im trying to include a macro that
will automatically run when the workbook is opened in read/write format
but will not run when its read only.
I understand macro's but aint got a clue on how to do this if it can be
done. If it can could I poss have a idiot proof guide.
Many Thanks--
tweacle
You could add a single line to the top of your proceduOption Explicit
Sub auto_open()
If ThisWorkbook.ReadOnly Then Exit Sub
'your normal code here
End Sub
(or workbook_open if you used that)
tweacle wrote:
gt;
gt; I have a workbook which is networked. Im trying to include a macro that
gt; will automatically run when the workbook is opened in read/write format
gt; but will not run when its read only.
gt;
gt; I understand macro's but aint got a clue on how to do this if it can be
gt; done. If it can could I poss have a idiot proof guide.
gt;
gt; Many Thanks
gt;
gt; --
gt; tweacle
--
Dave Peterson
at the top menu beside File, there is an excel symbol, right click on
that icon and select view codes,
Now at the drop down menu where it says general, drop down the menu to
select -workbook
go to the next drop down menu and select -open
beginning and ending code appears
put your copy and paste your macro between these two lines of code
for example purposes
popy and paste this code in between those two linesDim Msg As String
Msg = quot;This is Dave's great WorkBook!!quot;
MsgBox Msg
it will end up looking like thisPrivate Sub Workbook_Open()
Dim Msg As String
Msg = quot;This is Dave's great WorkBook!!quot;
MsgBox Msg
End Sub
Once you have that right then practise butting in the code from your
macro
Dave--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: www.excelforum.com/member.php...oamp;userid=31708
View this thread: www.excelforum.com/showthread...hreadid=516505
- Sep 29 Fri 2006 20:09
Run a macro automatically on workbook open
close
全站熱搜
留言列表
發表留言