Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Open Event does not activate the code

  Asked By: Leon    Date: Feb 26    Category: MS Office    Views: 569
  

I am trying to activate some code when a workbook opens. Code as
follows:-
'Private Sub Workbook_Open()
Application.MoveAfterReturnDirection = xlToRight
End Sub'
The code is not being activated on opening the workbook. What am I
doing wrong ???

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Melissa King     Answered On: Feb 26

Are you sure it's not being activated? Put a "stop" command into the sub as
well and see if it triggers the debugger.

If it's not being run, it might be in the wrong  module/ It needs to be in
the ThisWorkbook module.

If it is being run, but nothing appears to change, then you probably also
need an Application.MoveAfterReturn statement.

 
Answer #2    Answered By: Clayton Richardson     Answered On: Feb 26

I tried the "stop" but nothing triggered.
The code  is not in the ThisWorkbook Module. I have not come across
ThisWorkbook. How do I access this ?

 
Answer #3    Answered By: Adelinda Fischer     Answered On: Feb 26

: I tried the "stop" but nothing triggered.
: The code  is not in the ThisWorkbook Module. I have not
: come across ThisWorkbook. How do I access this ?

Press Control+R to open  the Project Explorer window.
If nothing happens this window is already open. Scroll
down to VBAProject(Name), where "Name" is the name of
your workbook. Click on the plus sign to expand the
folder and double click on ThisWorkbook.

 
Answer #4    Answered By: Tamara Nguyen     Answered On: Feb 26

: I am trying to activate  some code  when a workbook  opens.
: Code as follows:-
: 'Private Sub Workbook_Open()
: Application.MoveAfterReturnDirection = xlToRight
: End Sub'
: The code is not being activated on opening  the workbook.
: What am I doing wrong  ???

Which module did you place this code in? It should go
in the "ThisWorkbook" object under the Microsoft Excel
Objects folder.

 
Didn't find what you were looking for? Find more on Open Event does not activate the code Or get search suggestion and latest updates.




Tagged: