ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need Code To Print From Code Modules (https://www.excelbanter.com/excel-programming/331098-need-code-print-code-modules.html)

davidm

Need Code To Print From Code Modules
 

Minor correction: initializing loop counter to 1

I have been struggling with coming up with a code to print the contents
from other (general) code modules. Suppose I have
Sub test1()
Sub test2()
Sub test3()
in 3 separate modules, Module1,Module2, modulue3
I want my code Sub PrintCodes() in another module (preferably, in
personal.xls file) to loop through all the 3 codes and reel off
prints.

This is my effort thus far (not working!):

Sub PrintCodes()
i =1
For i = 1 to 3
set x = ThisWorkBook.VbProject.CodeModule(i).("test" & i)
x.print
i = i+1
next
End Sub


TIA


--
davidm
------------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...o&userid=20645
View this thread: http://www.excelforum.com/showthread...hreadid=376987



All times are GMT +1. The time now is 03:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com