C
cottage6
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,F:F,H:H,J:J,L:L,N:N,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
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,F:F,H:H,J:J,L:L,N:N,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