jtdewhurst
New Member
- Joined
- Jan 16, 2015
- Messages
- 26
Hello,
I'm trying to open, write-to, save, and close a workbook in VBA. I'm using the .close(true) method. I've also tried the following.
However, everything I've tried works, but when I go to open the file that I edited, it tells me it is locked for editing. If I open a read only, then exit. I can open it fine the next time. So it seems like the methods are not really closing, and terminating the application.
Any thoughts?
Thanks
I'm trying to open, write-to, save, and close a workbook in VBA. I'm using the .close(true) method. I've also tried the following.
Code:
Sub UPDT_DLY_PRDCT_CNT()
Dim XLapp As New Excel.Application
Dim ObjXL As Excel.Workbook
Set ObjXL = XLapp.Workbooks.Open("G:\TAE\Private\Jobs\PW\30K\Production\Engineering\Singlet NCR Tracking\Singlet NCR Tracking.xlsm")
ObjXL.Sheets("Daily Production Totals").Cells(4, 1).EntireRow.Insert
Dim k As Integer
For k = 1 To 3
ObjXL.Sheets("Daily Production Totals").Cells(4, k).Value = Workbooks("Book1").Sheets("Production History").Cells(4, k).Value
Next k
ObjXL.Save
ObjXL.Close
XLapp.Quit
End Sub
However, everything I've tried works, but when I go to open the file that I edited, it tells me it is locked for editing. If I open a read only, then exit. I can open it fine the next time. So it seems like the methods are not really closing, and terminating the application.
Any thoughts?
Thanks