below is the code, if you guys want to refer and provide me some help![]()
In the Private Module of "ThisWorkbook"
Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.OnTime dTime, "PullInSheet1", , False End Sub Private Sub Workbook_Open() Application.OnTime Now + TimeValue("00:00:01"), "PullInSheet1" End Sub
And Code in a Standard Module
Public dTime As Date Sub PullInSheet1() dTime = Now + TimeValue("00:00:11") Application.OnTime dTime, "PullInSheet1" 'Written By OzGrid Business Applications 'www.ozgrid.com 'Pulls in all data from sheet1 of a closed workbook. Dim AreaAddress As String Application.EnableCancelKey = xlDisabled 'Clear sheet ready for new data Sheet1.UsedRange.Clear 'Reference the UsedRange Address of Sheet1 in the closed Workbook. Sheet1.Cells(1, 1) = "= 'C:\Users\MVishwakarma\Desktop\AR\" & "[Current Month Salesboard for Video Wall_Data.xlsm]Sheet2'!RC" 'Pass the area Address to a String AreaAddress = Sheet1.Cells(1, 1) With Sheet1.Range(AreaAddress) 'If the cell in Sheet1 of the closed workbook is not empty the pull in it's content, else put in an Error. .FormulaR1C1 = "=IF('C:\Users\MVishwakarma\Desktop\AR\" & "[Current Month Salesboard for Video Wall_Data.xlsm]Sheet1'!RC="""",NA(),'C:\Users\MVishwakarma\Desktop\" & "AR\[Current Month Salesboard for Video Wall_Data.xlsm]Sheet1'!RC)" 'Delete all Error cells On Error Resume Next .SpecialCells(xlCellTypeFormulas, xlErrors).Clear On Error GoTo 0 'Change all formulas to Values only .Value = .Value End With If Application.Ready = True Then ThisWorkbook.Close SaveChanges:=True Application.Quit Else End If End Sub
The code is working fine, but it gives me an error "method 'ontime' of object '_application' failed" for the first time it is executed. And sometime it go into break mode. Please help![]()
Thanks...




					
				
                    
            
            
        
 
  
					
					
					
						
  Reply With Quote