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 […]

How to write a function and call a function in excel macros

Here I am creating a function called  form1(FileNum As Integer) and calling the function in g() using Call form1(FileNum) Sub form1(FileNum As Integer) Workbooks.Open (“c:\test\test1.xlsx”) Sheets(“Sheet1″).Activate Open “C:\test\test1.html” For Output As #FileNum ‘ creates the file if it doesn’t exist If Cells(1, 1) <> “” Then Title = Cells(2, 2) URL = Cells(1, 2) Print […]