How to call a procedure or module in another procedure or module VBA Excel

Here is the solution to call a procedure or module in another procedure or module VBA Excel.

Code from Module 1.

 Public Sub ScriptFooter(FileNum As Integer)
            Print #FileNum, "</tbody></table>"
End Sub

 Code from Module 2.

Public Sub CommandButton1_Click()
'code written on 21/01/2010 by Pavandeep Puddupakkam
  
    Dim FileNum As Integer
   Sheets("Search").Activate
    FileNum = FreeFile ' next file number
    Open "C:\XXX.txt" For Output As #FileNum ' creates the file if it doesn't exist
              Call Module1.ScriptFooter(FileNum)
     Close #FileNum ' close the file
    
End Sub

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by: wiki
Posted on: 1/28/2010 at 3:55 PM
Tags: , , , , ,
Categories: VBA Macros
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Add comment


 

  Country flag

biuquote
  • Comment
  • Preview
Loading