Forum

Stop Printing Works...
 
Notifications
Clear all

Stop Printing Worksheet macro

9 Posts
2 Users
0 Reactions
81 Views
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Don't understand the VB can not work, can debug an rectify the mistake per attached

 
Posted : 30/10/2020 9:58 pm
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
 

Hi David,

Workbook Event code needs to be in the ThisWorkbook module, not in a separate code module.  Move your code into the ThisWorkbook module- see image.

And remove this line from the code Sub NPrinting()

Phil

 

modules.png

 
Posted : 30/10/2020 11:39 pm
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Thanks Philip, will  try on that.

 
Posted : 30/10/2020 11:56 pm
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Sorry how to move the code to the Workbook Module?

 
Posted : 31/10/2020 12:05 am
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
 

Hi David,

Open the workbook.

Open the VBA editor (ALT+F11)

Open the code module for the sheet (double click it)

Select all the code, then cut it (CTRL+X)

Open the ThisWorkbook module by double clicking it

Paste the code into ThisWorkbook (CTRL+V)

Regards

Phil

 
Posted : 31/10/2020 12:52 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Thanks Philip, it works perfectly~

 
Posted : 31/10/2020 1:24 am
Philip Treacy
(@philipt)
Posts: 1630
Member Admin
 

Glad to hear it's working

 
Posted : 31/10/2020 1:31 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Sorry, Philip  suddenly the Code not works pls help see what I have mess-up ~

 
Posted : 31/10/2020 2:19 am
(@david_ng)
Posts: 310
Reputable Member
Topic starter
 

Now It's OK problems fixed!

 
Posted : 02/11/2020 8:01 pm
Share: