Attribute VB_Name = "T21Enquiry" Dim isdone Dim xlsfile, csvfile Sub Export_and_Save() Attribute Export_and_Save.VB_ProcData.VB_Invoke_Func = "e\n14" ' ' Export to Enquiry csv, Save xls lastrow = ActiveCell.SpecialCells(xlLastCell).Row 'MsgBox ("Last Row = " + Str(lastrow)) 'Application.DefaultFilePath = "W:\tx\databinding" 'MsgBox ("DefaultFilePath=[" + Application.DefaultFilePath + "]") 'If (MsgBox("Update RecordNo last=" + Str(lastrow), vbOKCancel) = vbCancel) Then ' Exit Sub 'End If For i = 2 To lastrow Cells(i, 1).Value = i Next MsgBox ("xlsfile = " + xlsfile + " csvfile = " + csvfile) 'ActiveWorkbook.Save ActiveWorkbook.SaveAs FileName:=csvfile, FileFormat:=xlCSVMSDOS, CreateBackup:=False ActiveWorkbook.SaveAs FileName:=xlsfile, FileFormat:=xlNormal, CreateBackup:=False 'MsgBox ("Should Exit Here") isdone = 1 End Sub Sub Set_Filenames(xlsfn, csvfn) xlsfile = xlsfn csvfile = csvfn End Sub Sub Goto_Rec(arg1) ' ' Goto_Rec Macro ' Goto Specified Record isdone = 0 'Columns("A:A").Select 'Selection.Find(What:=arg1, After:=ActiveCell, LookIn:=xlFormulas, _ ' LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ ' MatchCase:=False).Activate 'MsgBox (arg1) Range(arg1).Select End Sub Function is_done(testonly) If testonly = 0 Then 'MsgBox ("reset isdone") isdone = 0 End If 'MsgBox ("is_done return =" + Str(isdone)) is_done = isdone End Function