I am asking a general question. I have a long code and I am getting an error message " Procedure too large". I guess I need to divide my code into some subroutines / modules.
For example if I have a code with bunch of variables predefined as follows:
I have skipped several lines of code above and below the original subroutine. What I want to know is how can I separate the variables from 'C3 to the end of file and then copy these to a separate file and then refer them to the main subroutine. I tried creating a subroutine and used the code "Call sub trial()" (for eg) but it didn't work. I tried to export those data to module but it says "invalid outside procedure". Would someone suggest the best approach ?Code:Private Sub cmdreadQEA_Click() Dim DataString As String Dim Plus As Long, Equals As Long, Comma As Long 'Dim varname As String, VarVal As String Dim outfile As String Dim numline As Integer Dim myLine As String Dim y As Integer Dim numLinesWithPlusSign As Integer Dim strFile As String Dim NSQIJM As Integer 'Dim varname1() As String ' Dim varval1() As String Label1 = NQSIJM ReDim NQSMUL(NSQIJM), NQSMF(NSQIJM) ' ********************************************************************************* ' Data from friend ' ********************************************************************************* ISRESTO = -1 ISPAR = 0 ISLOG = 1 ISDIVEX = 0 ISMMC = 0 ISHP = 0 ISHOW = 0 'C3 RP = 1.8 RPADJ = 1.8 RSQMADJ = 1E-16 ITRMADJ = 1000 ITERHPM = 0 ISDSOLV = 0 FILT3TL = 0.0625 'C4 ISSSMMT = 0 ISLTMTS = 0 ISIA = 0 RPIA = 1.8 RSQMIA = 0.0000000001 ITRMIA = 1000 'C5 ISCDMA = 0 ISHDMF = 1 ' To turn off diffusion set this to 0. ISDISP = 0 ISWASP = 0 ISQQ = 1 ISRLID = 0 ISVEGL = 0 ISEVER = 0 'C6 For i = 0 To 8 ISTOPT(i) = 0 ISCDCA(i) = 0 ISPLIT(i) = 0 ISADAH(i) = 0 ISADAV(i) = 0 ISCI(i) = 0 ISCO(i) = 0 Next End Sub




Reply With Quote
