+ Reply to Thread
Results 1 to 8 of 8

taking too long to load

  1. #1
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Post taking too long to load

    Hi guys,

    I came up with a code that helps me to automate my excel.
    It is working, but it takes a very long time to execute.(around 2-3mins)

    Can someone help me solve this issue?

    Part 1

    [QUOTE][QUOTE][CODE]Option Explicit
    Dim i As Integer
    Dim sheetname As String
    Dim WDApp As Word.Application ' early binding
    Dim WDDoc As Word.Document
    Dim FSOobj As Object
    Dim actionstop As String
    Dim actioncount As Integer


    Sub saveall()
    '############################SAVE CLOSE EXPORT################################################
    Set WDApp = GetObject(, "Word.Application")
    WDApp.Visible = True

    Set WDDoc = WDApp.ActiveDocument
    sheetname = ActiveSheet.Name

    Application.Worksheets(sheetname).Activate
    actionstop = ""
    newtemplatecheck



    If actionstop = "stop" Then Exit Sub

    'On Error GoTo Last
    Dim reportbupath As String
    Dim reportname As String
    Dim fso As Object
    Dim formatDDMMYY As String
    Dim formatyyyymmdd As String
    Dim doc As String
    Dim Reportbufolder As String
    Dim vbf As String
    Dim vb As String
    Dim toreportftppath As String
    Dim reportpdf As String
    Dim strdir As String
    Dim toDoctorFolderPath As String
    Dim oldFile As Variant
    Dim newFile As Variant
    Dim newPath As Variant


    'saving document check
    formatDDMMYY = Format(Date, "DDMMYY")
    formatyyyymmdd = Format(Date, "YYYY-MM-DD")
    doc = ".doc"
    reportpdf = WDDoc.FormFields("NRIC").Result & "_" & formatDDMMYY & ".pdf"
    reportname = WDDoc.FormFields("NRIC").Result & "_" & formatDDMMYY & doc
    Reportbufolder = Sheets("DATA").Cells(1, 2).Value & Format(Date, "YYYY") & "\" & formatyyyymmdd & "\"
    reportbupath = Sheets("DATA").Cells(2, 2).Value & Format(Date, "YYYY") & "\" & formatyyyymmdd & "\" & reportname
    toreportftppath = Sheets("DATA").Cells(3, 2).Value
    'toDoctorFolder = Sheets("DATA").Cells(4, 2).Value & Format(Date, "YYYY") & "\" & formatyyyymmdd & "\"
    toDoctorFolderPath = Sheets("DATA").Cells(5, 2).Value


    will continue on another pose

  2. #2
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: taking too long to load

    part 2

    oldFile = toreportftppath & reportpdf
    newPath = toDoctorFolderPath & Format(Date, "YYYY-MM-DD")
    newFile = newPath & "\" & reportpdf
    strdir = toDoctorFolderPath


    If Dir(newPath, vbDirectory) = "" Then
    MkDir newPath
    End If

    Set fso = CreateObject("Scripting.FilesystemObject")

    If fso.FolderExists(Reportbufolder) = False Then
    vbf = MsgBox("Folder not created. Created " & formatyyyymmdd & " folder?", vbOKCancel)

    If vbf = vbOK Then
    fso.CreateFolder (Reportbufolder)
    ElseIf vbf = vbCancel Then
    Exit Sub
    End If

    End If

    If fso.FileExists(reportbupath) = False Then

    WDDoc.SaveAs reportbupath

    WDDoc.ExportAsFixedFormat OutputFileName:= _
    Reportbufolder & WDDoc.FormFields("NRIC").Result & "_" & formatDDMMYY & ".pdf", ExportFormat:= _
    wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
    wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
    BitmapMissingFonts:=True, UseISO19005_1:=False


    ElseIf fso.FileExists(reportbupath) = True Then
    vb = MsgBox("Copy already present in server. Do you want to continue overwriting the file?", vbOKCancel)

    If vb = vbOK Then
    WDDoc.SaveAs reportbupath
    WDDoc.ExportAsFixedFormat OutputFileName:= _
    Reportbufolder & WDDoc.FormFields("NRIC").Result & "_" & formatDDMMYY & ".pdf", ExportFormat:= _
    wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
    wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
    BitmapMissingFonts:=True, UseISO19005_1:=False
    ElseIf vb = vbCancel Then
    Sheets(sheetname).Select
    Exit Sub
    End If

    End If

    Dim ImageFromFTPPath As String
    Dim Imagetobupath As String
    Dim count As Integer
    ImageFromFTPPath = "H:\IN\" 'HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    Imagetobupath = "Z:\SGH Diabetes Centre\Images\" & Format(Date, "YYYY") & "\" & formatyyyymmdd & "\" ' HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


    Set FSOobj = CreateObject("Scripting.FilesystemObject")

    If FSOobj.FolderExists(Imagetobupath) = False Then
    vbf = MsgBox("Folder not created. Created " & formatyyyymmdd & " folder?", vbOKCancel)
    If vbf = vbOK Then
    FSOobj.CreateFolder (Imagetobupath)
    ElseIf vb = vbCancel Then
    Exit Sub

    End If
    End If

    If fso.FileExists(toreportftppath & reportpdf) = False Then
    'WDDoc.SaveAs toreportftppath & reportname
    WDDoc.Activate

    WDDoc.ExportAsFixedFormat OutputFileName:= _
    toreportftppath & reportpdf, ExportFormat:= _
    wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
    wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
    BitmapMissingFonts:=True, UseISO19005_1:=False

    ElseIf fso.FileExists(toreportftppath & reportpdf) = True Then
    vb = MsgBox("Copy already present in FTP. Do you want to continue overwriting the file?", vbOKCancel)

    If vb = vbOK Then
    'WDDoc.SaveAs toreportftppath & reportname
    WDDoc.Activate

    WDDoc.ExportAsFixedFormat OutputFileName:= _
    toreportftppath & reportpdf, ExportFormat:= _
    wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
    wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
    Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
    CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
    BitmapMissingFonts:=True, UseISO19005_1:=False

    ElseIf vb = vbCancel Then
    Sheets(sheetname).Select
    Exit Sub
    End If
    End If


    WDDoc.Close
    WDApp.Quit



    Set FSOobj = Nothing

    Dim objgetFolder As Object
    Dim getfolder As Object
    Dim objFile As Object
    Dim ID As String
    Dim reportID As String

    reportID = ActiveSheet.Cells(i, 4).Value
    checkTime reportID, ImageFromFTPPath
    Set fso = CreateObject("scripting.filesystemobject")
    Set objgetFolder = fso.getfolder(ImageFromFTPPath) 'polyclinic FTP drive

    count = 0


    If Len(reportID) > 9 Then
    For Each objFile In objgetFolder.Files 'check each and every file inside
    If Left(objFile.Name, Len(reportID)) = reportID Then
    If fso.FileExists(Imagetobupath & objFile.Name) = False Then
    fso.MoveFile Source:=objFile, Destination:=Imagetobupath
    count = count + 1
    End If
    End If
    Next
    Else
    For Each objFile In objgetFolder.Files 'check each and every file inside

  3. #3
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: taking too long to load

    part 3
    If Left(objFile.Name, 9) = reportID Then
    If fso.FileExists(Imagetobupath & objFile.Name) = False Then
    fso.MoveFile Source:=objFile, Destination:=Imagetobupath
    count = count + 1
    End If
    End If
    Next
    End If
    If count = 0 Then
    MsgBox "OI!!! ZERO files was transferred."
    End If






    MsgBox ID & "Total " & count & " files had been transferred" & "Process finished"
    count = 0
    'Exit Sub
    '######

  4. #4
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: taking too long to load

    Part 4/
    ######################SAVE CLOSE EXPORT################################################

    FileCopy oldFile, newFile

    MsgBox "Report Saved"
    End Sub

    Sub checkTime(reportID As String, ImageFromFTPPath As String)
    Dim dte As Date
    Dim onlyTime As Date
    Dim fullDateTime As String
    Dim imageCreatedTime As Date
    Dim timeDifference As Double
    Dim oFS As Object
    Dim fileName As String
    Set oFS = CreateObject("Scripting.FileSystemObject")
    fileName = ImageFromFTPPath & reportID & ".xlsx"
    onlyTime = Format(Time, "hh:mm")
    imageCreatedTime = Format(oFS.GetFile(fileName).DateCreated, "HH:MM")
    Sheets("DATA").Cells(6, 2).Value = imageCreatedTime
    Sheets("DATA").Cells(7, 2).Value = TimeDiff(onlyTime, imageCreatedTime) / 60
    Set oFS = Nothing
    End Sub

    Function TimeDiff(StartTime As Date, StopTime As Date)

    TimeDiff = Abs(StopTime - StartTime) * 86400
    End Function

  5. #5
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: taking too long to load

    part 5

    Sub newtemplatecheck()

    Set WDApp = GetObject(, "Word.Application")
    WDApp.Visible = True

    Set WDDoc = WDApp.ActiveDocument
    sheetname = ActiveSheet.Name
    Application.ScreenUpdating = False
    actioncount = 0

    If WDDoc.FormFields("NoRetinopathyRE").CheckBox.Value = False And WDDoc.FormFields("MinimalRE").CheckBox.Value = False And _
    WDDoc.FormFields("MildRE").CheckBox.Value = False And WDDoc.FormFields("ModerateRE").CheckBox.Value = False And _
    WDDoc.FormFields("SevereRE").CheckBox.Value = False And WDDoc.FormFields("ProliferativeRE").CheckBox.Value = False And _
    WDDoc.FormFields("MacularEdemaRE").CheckBox.Value = False And WDDoc.FormFields("PStableRE").CheckBox.Value = False And _
    WDDoc.FormFields("PActiveRE").CheckBox.Value = False Then

    If WDDoc.FormFields("NoRetinopathyLE").CheckBox.Value = False And WDDoc.FormFields("MinimalLE").CheckBox.Value = False And _
    WDDoc.FormFields("MildLE").CheckBox.Value = False And WDDoc.FormFields("ModerateLE").CheckBox.Value = False And _
    WDDoc.FormFields("SevereLE").CheckBox.Value = False And WDDoc.FormFields("ProliferativeLE").CheckBox.Value = False And _
    WDDoc.FormFields("MacularEdemaLE").CheckBox.Value = False And WDDoc.FormFields("PStableLE").CheckBox.Value = False And _
    WDDoc.FormFields("PActiveLE").CheckBox.Value = False Then

    If WDDoc.FormFields("GlacomaSuspectRE").CheckBox.Value = False And WDDoc.FormFields("GlacomaSuspectLE").CheckBox.Value = False Then

    If WDDoc.FormFields("AMD_RE").CheckBox.Value = False And WDDoc.FormFields("AMD_LE").CheckBox.Value = False Then

    If WDDoc.FormFields("CataractRE").CheckBox.Value = False And WDDoc.FormFields("CataractLE").CheckBox.Value = False Then

    If WDDoc.FormFields("UngradableRE").CheckBox.Value = False And WDDoc.FormFields("UngradableLE").CheckBox.Value = False Then

    If WDDoc.FormFields("Others").Result = "N.A." And WDDoc.FormFields("OthersRE").CheckBox.Value = False And _
    WDDoc.FormFields("OthersLE").CheckBox.Value = False Then

    If WDDoc.FormFields("MainFinding").Result = "Please Select" And WDDoc.FormFields("Comments").Result = "" And _
    WDDoc.FormFields("ReScreen6Months").CheckBox.Value = False Then

    If WDDoc.FormFields("Immediate").CheckBox.Value = False And WDDoc.FormFields("Week1").CheckBox.Value = False And _
    WDDoc.FormFields("Month1").CheckBox.Value = False And WDDoc.FormFields("Months3").CheckBox.Value = False And _
    WDDoc.FormFields("Months6").CheckBox.Value = False Then

    actioncount = actioncount + 1

    End If
    End If
    End If
    End If
    End If
    End If
    End If
    End If
    End If

    If actioncount > 0 Then
    actionstop = "stop"
    MsgBox "The form has not been edited!!!", vbExclamation, "Form validation"
    Exit Sub
    End If


    actioncount = 0
    If WDDoc.FormFields("Immediate").CheckBox.Value = True Then actioncount = actioncount + 1
    If WDDoc.FormFields("Week1").CheckBox.Value = True Then actioncount = actioncount + 1
    If WDDoc.FormFields("Week2").CheckBox.Value = True Then actioncount = actioncount + 1
    If WDDoc.FormFields("Months1").CheckBox.Value = True Then actioncount = actioncount + 1
    If WDDoc.FormFields("Months3").CheckBox.Value = True Then actioncount = actioncount + 1

    If actioncount > 1 Then
    actionstop = "stop"
    MsgBox "Please check the Referral column, More than 1 referral checked!!!", vbExclamation, "Form validation"
    Exit Sub
    End If


    'main diagnosis
    If WDDoc.FormFields("MainFinding").Result = "Please Select" Then
    actionstop = "stop"
    MsgBox "Please check the Main Diagnosis, it is not selected!!!", vbExclamation, "Form validation"
    Exit Sub
    End If

    'Others validation
    If WDDoc.FormFields("Others").Result <> "N.A" Then
    If WDDoc.FormFields("OthersRE").CheckBox.Value = False And WDDoc.FormFields("OthersLE").CheckBox.Value = False Then
    actionstop = "stop"
    MsgBox "Please check the Others Ocular finding, it is not selected!!!", vbExclamation, "Form validation"
    Exit Sub
    End If
    End If

    '########################## SET TIME ####################################
    'MsgBox Application.Text(timeDifference, "[hh]:mm")

    'Cells(i, 7).NumberFormat = "[hh]:mm"

  6. #6
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: taking too long to load

    part 6

    i = Sheets(sheetname).Cells(Rows.count, 1).End(xlUp).Offset(1, 0).Row ' Count to the last row

    Cells(i, 1).Value = Sheets(sheetname).Cells(1, 4).Value
    Cells(i, 2).Value = Format(Date, "dd-mmm-yy")
    Cells(i, 3).Value = Format(Weekday(Now, vbUseSystemDayOfWeek), "dddd")
    Cells(i, 4).Value = WDDoc.FormFields("NRIC").Result
    Cells(i, 5).Value = Sheets("DATA").Cells(6, 2).Value
    Cells(i, 6).Value = Format(Time, "hh:mm")
    Cells(i, 7).Value = Sheets("DATA").Cells(7, 2).Value
    Cells(i, 9).Value = WDDoc.FormFields("PinholeRightEye").Result
    Cells(i, 10).Value = WDDoc.FormFields("AidedRightEye").Result
    Cells(i, 11).Value = WDDoc.FormFields("PinholeLeftEye").Result
    Cells(i, 12).Value = WDDoc.FormFields("AidedLeftEye").Result
    Cells(i, 13).Value = WDDoc.FormFields("NoRetinopathyRE").CheckBox.Value
    Cells(i, 14).Value = WDDoc.FormFields("MinimalRE").CheckBox.Value
    Cells(i, 15).Value = WDDoc.FormFields("MildRE").CheckBox.Value
    Cells(i, 16).Value = WDDoc.FormFields("ModerateRE").CheckBox.Value
    Cells(i, 17).Value = WDDoc.FormFields("SevereRE").CheckBox.Value
    Cells(i, 18).Value = WDDoc.FormFields("ProliferativeRE").CheckBox.Value
    Cells(i, 19).Value = WDDoc.FormFields("MacularEdemaRE").CheckBox.Value
    Cells(i, 20).Value = WDDoc.FormFields("NoRetinopathyLE").CheckBox.Value
    Cells(i, 21).Value = WDDoc.FormFields("MinimalLE").CheckBox.Value
    Cells(i, 22).Value = WDDoc.FormFields("MildLE").CheckBox.Value
    Cells(i, 23).Value = WDDoc.FormFields("ModerateLE").CheckBox.Value
    Cells(i, 24).Value = WDDoc.FormFields("SevereLE").CheckBox.Value
    Cells(i, 25).Value = WDDoc.FormFields("ProliferativeLE").CheckBox.Value
    Cells(i, 26).Value = WDDoc.FormFields("MacularEdemaLE").CheckBox.Value
    Cells(i, 27).Value = WDDoc.FormFields("GlacomaSuspectRE").CheckBox.Value
    Cells(i, 28).Value = WDDoc.FormFields("GlacomaSuspectLE").CheckBox.Value
    Cells(i, 29).Value = WDDoc.FormFields("AMD_RE").CheckBox.Value
    Cells(i, 30).Value = WDDoc.FormFields("AMD_LE").CheckBox.Value
    Cells(i, 31).Value = WDDoc.FormFields("CataractRE").CheckBox.Value
    Cells(i, 32).Value = WDDoc.FormFields("CataractLE").CheckBox.Value
    Cells(i, 33).Value = WDDoc.FormFields("UngradableRE").CheckBox.Value
    Cells(i, 34).Value = WDDoc.FormFields("UngradableLE").CheckBox.Value
    Cells(i, 35).Value = WDDoc.FormFields("Others").Result
    Cells(i, 36).Value = WDDoc.FormFields("OthersRE").CheckBox.Value
    Cells(i, 37).Value = WDDoc.FormFields("OthersLE").CheckBox.Value
    Cells(i, 38).Value = WDDoc.FormFields("MainFinding").Result
    Cells(i, 39).Value = WDDoc.FormFields("Comments").Result
    Cells(i, 40).Value = WDDoc.FormFields("NextVisitDate").Result
    Cells(i, 41).Value = WDDoc.FormFields("ReScreen6Months").CheckBox.Value
    Cells(i, 42).Value = WDDoc.FormFields("Normal").CheckBox.Value
    Cells(i, 43).Value = WDDoc.FormFields("Abnormal").CheckBox.Value
    Cells(i, 44).Value = WDDoc.FormFields("PStableRE").CheckBox.Value
    Cells(i, 45).Value = WDDoc.FormFields("PStableLE").CheckBox.Value
    Cells(i, 46).Value = WDDoc.FormFields("PActiveRE").CheckBox.Value
    Cells(i, 47).Value = WDDoc.FormFields("PActiveLE").CheckBox.Value
    Cells(i, 48).Value = WDDoc.FormFields("Immediate").CheckBox.Value
    Cells(i, 49).Value = WDDoc.FormFields("Week1").CheckBox.Value
    Cells(i, 50).Value = WDDoc.FormFields("Week2").CheckBox.Value
    Cells(i, 51).Value = WDDoc.FormFields("Months1").CheckBox.Value
    Cells(i, 52).Value = WDDoc.FormFields("Months3").CheckBox.Value



    '############################ROW FORMAT IF TRUE###############################################
    Dim rowColor As Integer
    For rowColor = 0 To 4
    If Cells(i, (48 + rowColor)).Value = "True" Then
    ActiveSheet.Range("a" & i, "az" & i).Select
    With Selection.Font
    .Color = -4165632
    .TintAndShade = 0
    End With
    Exit For
    End If
    Next
    '############################ROW FORMAT IF TRUE###############################################
    With WDDoc
    '
    ' .FormFields("PinholeRightEye1").Result = .FormFields("PinholeRightEye").Result
    ' .FormFields("AidedRightEye1").Result = .FormFields("AidedRightEye").Result
    ' .FormFields("PinholeLeftEye1").Result = .FormFields("PinholeLeftEye").Result
    ' .FormFields("AidedLeftEye1").Result = .FormFields("AidedLeftEye").Result
    .FormFields("NoRetinopathyRE1").CheckBox.Value = .FormFields("NoRetinopathyRE").CheckBox.Value
    .FormFields("MinimalRE1").CheckBox.Value = .FormFields("MinimalRE").CheckBox.Value
    .FormFields("MildRE1").CheckBox.Value = .FormFields("MildRE").CheckBox.Value
    .FormFields("ModerateRE1").CheckBox.Value = .FormFields("ModerateRE").CheckBox.Value
    .FormFields("SevereRE1").CheckBox.Value = .FormFields("SevereRE").CheckBox.Value
    .FormFields("ProliferativeRE1").CheckBox.Value = .FormFields("ProliferativeRE").CheckBox.Value
    .FormFields("MacularEdemaRE1").CheckBox.Value = .FormFields("MacularEdemaRE").CheckBox.Value
    .FormFields("NoRetinopathyLE1").CheckBox.Value = .FormFields("NoRetinopathyLE").CheckBox.Value
    .FormFields("MinimalLE1").CheckBox.Value = .FormFields("MinimalLE").CheckBox.Value
    .FormFields("MildLE1").CheckBox.Value = .FormFields("MildLE").CheckBox.Value
    .FormFields("ModerateLE1").CheckBox.Value = .FormFields("ModerateLE").CheckBox.Value
    .FormFields("SevereLE1").CheckBox.Value = .FormFields("SevereLE").CheckBox.Value
    .FormFields("ProliferativeLE1").CheckBox.Value = .FormFields("ProliferativeLE").CheckBox.Value
    .FormFields("MacularEdemaLE1").CheckBox.Value = .FormFields("MacularEdemaLE").CheckBox.Value
    .FormFields("GlacomaSuspectRE1").CheckBox.Value = .FormFields("GlacomaSuspectRE").CheckBox.Value
    .FormFields("GlacomaSuspectLE1").CheckBox.Value = .FormFields("GlacomaSuspectLE").CheckBox.Value
    .FormFields("AMD_RE1").CheckBox.Value = .FormFields("AMD_RE").CheckBox.Value
    .FormFields("AMD_LE1").CheckBox.Value = .FormFields("AMD_LE").CheckBox.Value
    .FormFields("CataractRE1").CheckBox.Value = .FormFields("CataractRE").CheckBox.Value
    .FormFields("CataractLE1").CheckBox.Value = .FormFields("CataractLE").CheckBox.Value
    .FormFields("UngradableRE1").CheckBox.Value = .FormFields("UngradableRE").CheckBox.Value
    .FormFields("UngradableLE1").CheckBox.Value = .FormFields("UngradableLE").CheckBox.Value
    .FormFields("Others1").Result = .FormFields("Others").Result
    .FormFields("OthersRE1").CheckBox.Value = .FormFields("OthersRE").CheckBox.Value
    .FormFields("OthersLE1").CheckBox.Value = .FormFields("OthersLE").CheckBox.Value
    .FormFields("MainFinding1").Result = .FormFields("MainFinding").Result
    .FormFields("Comments1").Result = .FormFields("Comments").Result
    .FormFields("NextVisitDate1").Result = .FormFields("NextVisitDate").Result
    .FormFields("ReScreen6Months1").CheckBox.Value = .FormFields("ReScreen6Months").CheckBox.Value
    .FormFields("Normal1").CheckBox.Value = .FormFields("Normal").CheckBox.Value
    .FormFields("Abnormal1").CheckBox.Value = .FormFields("Abnormal").CheckBox.Value
    .FormFields("PStableRE1").CheckBox.Value = .FormFields("PStableRE").CheckBox.Value
    .FormFields("PStableLE1").CheckBox.Value = .FormFields("PStableLE").CheckBox.Value
    .FormFields("PActiveRE1").CheckBox.Value = .FormFields("PActiveRE").CheckBox.Value
    .FormFields("PActiveLE1").CheckBox.Value = .FormFields("PActiveLE").CheckBox.Value
    .FormFields("Immediate1").CheckBox.Value = .FormFields("Immediate").CheckBox.Value
    .FormFields("Week1_").CheckBox.Value = .FormFields("Week1").CheckBox.Value
    .FormFields("Week2_").CheckBox.Value = .FormFields("Week2").CheckBox.Value
    .FormFields("Months1_").CheckBox.Value = .FormFields("Months1").CheckBox.Value
    .FormFields("Months3_").CheckBox.Value = .FormFields("Months3").CheckBox.Value
    End With
    actioncount = 0


    Application.ScreenUpdating = True
    End Sub[/CODE][/QUOTE][/QUOTE]

  7. #7
    Registered User
    Join Date
    03-28-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: taking too long to load

    please note that part 1 to part 6 is a combination of the codes in 1 module.. can someone help me see why it is making my codes slow to execute?

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: taking too long to load

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro taking too long to finish
    By DKAbi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-17-2013, 06:23 PM
  2. [SOLVED] Issue - IE8 taking long to respond
    By arlu1201 in forum Suggestions for Improvement
    Replies: 2
    Last Post: 03-16-2012, 04:08 AM
  3. Is there anyway to see why ScreenUpdating is taking so long?
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-11-2011, 04:17 AM
  4. Taking cell values from Dashboard, and based on a value load in one of two sheets
    By califire in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-11-2011, 11:36 AM
  5. Reference Cells taking too long to load
    By dsrt16 in forum Excel General
    Replies: 0
    Last Post: 01-15-2009, 01:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1