![]() |
Excel file open in memory?
Hi all,
I have a spreadsheet and a .csv file that do things via a button in a Lotus Notes database. The .csv file extracts itself to the hard drive, and is then imported into the Excel spreadsheet using a Workbook_Open macro. I think I have a problem with a file or Excel staying open in memory, or will have very shortly. I just started getting an error saying the .csv file could not be found by the Workbook_Open macro. The file was not being extracted, but extracting it under another name worked just fine. I've posted the code below that exports the range and saves it as a .csv file. Code looks pretty primitive next to the other examples I've seen here, but anyway.... I was wondering if I need to do something else at the end of this? Any help would be greatly appreciated; I'm in over my head as usual! Sub Export() Application.DisplayAlerts = False Application.Goto Reference:="EXPORTRANGE" Selection.Copy Workbooks.Add Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False Range("E1").Select Selection.NumberFormat = "mm/dd/yyyy" ChDir "C:\Lotus\work\123" Range("B:B,D:D,F:F,H:H,J:J,L:L,N:N,P:P,R:R,T:T,V:V ,X:X,Z:Z").Select Range("B1").Activate Selection.Delete Shift:=xlToLeft ActiveWorkbook.SaveAs Filename:="C:\Lotus\work\123\bake.csv", _ FileFormat:=xlCSV, CreateBackup:=False ActiveWorkbook.Close Application.Quit End Sub |
Excel file open in memory?
Each file name in a Windows folder must be unique.
Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "cottage6" wrote in message Hi all, I have a spreadsheet and a .csv file that do things via a button in a Lotus Notes database. The .csv file extracts itself to the hard drive, and is then imported into the Excel spreadsheet using a Workbook_Open macro. I think I have a problem with a file or Excel staying open in memory, or will have very shortly. I just started getting an error saying the .csv file could not be found by the Workbook_Open macro. The file was not being extracted, but extracting it under another name worked just fine. I've posted the code below that exports the range and saves it as a .csv file. Code looks pretty primitive next to the other examples I've seen here, but anyway.... I was wondering if I need to do something else at the end of this? Any help would be greatly appreciated; I'm in over my head as usual! Sub Export() Application.DisplayAlerts = False Application.Goto Reference:="EXPORTRANGE" Selection.Copy Workbooks.Add Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Application.CutCopyMode = False Range("E1").Select Selection.NumberFormat = "mm/dd/yyyy" ChDir "C:\Lotus\work\123" Range("B:B,D:D,F:F,H:H,J:J,L:L,N:N,P:P,R:R,T:T,V:V ,X:X,Z:Z").Select Range("B1").Activate Selection.Delete Shift:=xlToLeft ActiveWorkbook.SaveAs Filename:="C:\Lotus\work\123\bake.csv", _ FileFormat:=xlCSV, CreateBackup:=False ActiveWorkbook.Close Application.Quit End Sub |
All times are GMT +1. The time now is 01:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com