call Modules

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,059
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have 2 Modules and trying to call each of then from a Module1. office 2016, it don't run the 2nd call (OpenNECopper) but execute the 1st call (OpenNEFiber)

Need to run both the calls from (OneonOne) , now its just running the 1st one and stops and don't run the 2nd call, is there a way to run both one after the other.


this is one module which I am calling other 2 modules.
VBA Code:
Sub OneonOne()

Call OpenNEFiber
Application.Wait (Now() + TimeValue("00:00:05"))

Call OpenNECopper
Application.Wait (Now() + TimeValue("00:00:05"))

MsgBox "Both calls are Complete", vbInformation, "Call 1 & 2"

End Sub


This is 1st one call

VBA Code:
Sub OpenNEFiber()
    Dim FilePath As String
    Dim FileName As String
    Dim wb As Workbook

    FilePath = ActiveWorkbook.Path
    FileName = "Golden Automation NE Fiber V1.xlsm" ' Replace with your file name

    FilePath = FilePath & "\" & FileName
    If Dir(FilePath) <> "" Then
        Set wb = Workbooks.Open(FilePath)
        Application.Wait (Now() + TimeValue("00:00:05"))
        Application.Run "'" & wb.Name & "'!FIberNEALL"
         wb.Close SaveChanges:=True
    Else
        MsgBox "File not found: " & FilePath
    End If
End Sub

this is 2nd one call

VBA Code:
Sub OpenNECopper()
    Dim FilePath As String
    Dim FileName As String
    Dim wb As Workbook


    FilePath = ActiveWorkbook.Path
    FileName = "Golden Automation NE Copper V1.xlsm" ' Replace with your file name


    FilePath = FilePath & "\" & FileName

    If Dir(FilePath) <> "" Then

        Set wb = Workbooks.Open(FilePath)

        Application.Wait (Now() + TimeValue("00:00:05"))

        Application.Run "'" & wb.Name & "'!callNECopperALL"
    
         wb.Close SaveChanges:=True
    Else
        MsgBox "File not found: " & FilePath
    End If

End Sub
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Your code is correct, so there must be something else interfering. What is the code you call in the first workbook you open?
 
Upvote 0
this is the code for 1st one.

VBA Code:
Sub FIberNEALL()

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''
''''''''''''' This is for Fiber NE
'''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Call RenameRawFilesNEFiber
Call ImportRawDataFinerNE

Call RearragneColumnsHuaweiFibber
Call RearragneColumnsNokiaFibber


Call CopyHuaweiDataAndPaste
Call CopyNokiaDataAndPaste

Call DuplicatesNEFiberCombine


End Sub

for 2nd one.
VBA Code:
Sub callNECopperALL()

'Call RenameRawFilesNECOPPER
Call ImportRawDataCopperNE


Call RearragneColumnsCopperADTRAN
Call RearragneColumnsNokiaCopper
Call RearragneColumnsCopperHuaweiE
Call RearragneColumnsCopperHuaweiC
Call RearragneColumnsCopperHuaweiS


Call CopyADTRANDataAndPaste
Call CopyNokiaCoperDataAndPaste
Call CopyHuaweiEDataAndPaste
Call CopyHuaweiCDataAndPaste
Call CopyHuaweiSDataAndPaste


Call DuplicatesNECoperCombine

End Sub
 
Upvote 0
That doesn't really help as it's just a bunch of calls to other routines. Have you verified at what exact point the code stops?
 
Upvote 0
It run the Call OpenNEFiber and don't moves to 2nd part Call OpenNECopper


VBA Code:
Sub OneonOne()

Call OpenNEFiber
Application.Wait (Now() + TimeValue("00:00:05"))

Call OpenNECopper
Application.Wait (Now() + TimeValue("00:00:05"))

MsgBox "Both calls are Complete", vbInformation, "Call 1 & 2"

End Sub
 
Upvote 0
Does it reach the first Application.Wait line? (not sure why you would need that)
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,964
Members
449,094
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top