
Originally Posted by
TMShucks
Might be worth sharing all the code and, ideally a sample workbook that demonstrates the problem.
I've stepped through the code manually and with a breakpoint on the code when pressing a command button and run it uninterrupted. The only issue I had was breaking the links but when I went into debug and stepped through it worked ... may be a timing problem.
Regards
The actual code is not very different from the one I reproduced earlier and the same is given below. I will try to prepare a sample workbook and post, if possible.
I want to again point out that the code runs properly on stepping through or running uder debug mode. Only while executing the macro from outside it stops.
About breaking the link problem, I wanted to handle that later. However, any suggestion is welcome.
Sub Macro1()
'
' Macro1 Macro
'
ProgName = ActiveWorkbook.Name
MasterPath = "c:\Data\ZIO\"
DataPath = "c:\Data\ZIO\"
Workbooks.Open FileName:=MasterPath & "AuditMasters.xlsx"
Windows(ProgName).Activate
Range("C8").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-1],[AuditMasters.xlsx]BranchDirectory!R2C1:R1500C2,2,FALSE)"
Range("B16").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(R[-8]C,[AuditMasters.xlsx]BranchMaster!R2C1:R1500C18,18,FALSE)"
Windows("AuditMasters.xlsx").Activate
ActiveWindow.Close
' ActiveWorkbook.BreakLink Name:="C:\Data\ZIO\AuditMasters.xlsx", Type:= _
' xlExcelLinks
End Sub
Bookmarks