C
childofthe1980s
Hello:
A client exports a file out of Crystal reports to Excel. Then, they go to
Tools...Macro and run a couple of very simple macros that are shown below.
Now, they are going to be getting rid of the computer that runs this and are
moving this report along with Excel to a new server where they will continue
to use this "programming".
I need to recreate all of this. I have upgraded the Crystal report and I
have the Excel macro, obviously. What I don't "get", is how this client has
been able to export the data from one application (Crystal) to an Excel
template or spreadsheet or csv file or whatever and allow for the macro to
just "be there" without being overwritten by the data exported from Excel.
You see, I'm sure that the macro programming is saved on an Excel template
somewhere where the client runs the two macros. But, how is the data
exported to this Excel file without overwriting the macros embedded in the
file?
Any ideas? If I can figure this out, then I can recreate this template and
save it on the server. Thanks!
childofthe1980s
Sub CrystalRpt2()
'
' CrystalRpt2 Macro
' Macro recorded 8/22/2005 by ewest
'
'
ActiveCell.Offset(0, 6).Columns("A:B").EntireColumn.Select
Selection.NumberFormat = "0"
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "x"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "x"
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlUp).Select
ActiveCell.FormulaR1C1 = "=+RC[-3]*1"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=+RC[-3]*100"
ActiveCell.Offset(0, -1).Range("A1:B1").Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("Template.csv").Activate
ActiveCell.Offset(0, -5).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("checkspaid.xls").Activate
ActiveCell.Offset(0, 6).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("Template.csv").Activate
ActiveCell.Offset(0, 3).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("checkspaid.xls").Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("Template.csv").Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("checkspaid.xls").Activate
ActiveCell.Offset(0, -2).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("Template.csv").Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub
Sub PosPay082305()
'
' PosPay082305 Macro
' Macro recorded 8/23/2005 by ewest
'
'
Columns("A:A").Select
Selection.NumberFormat = "@"
Selection.ColumnWidth = 12
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("B:B").Select
Selection.ColumnWidth = 1
Columns("C:C").Select
Selection.ColumnWidth = 2
Columns("D").Select
Selection.NumberFormat = "0000000000"
Selection.ColumnWidth = 10
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("E:E").Select
Selection.NumberFormat = "000000000000"
Selection.ColumnWidth = 12
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("F:F").Select
Selection.NumberFormat = "mmddyyyy"
Selection.ColumnWidth = 8
ActiveWorkbook.SaveAs Filename:="K:\Users\B of A Positive
Pay\Template.csv", _
FileFormat:=xlCSV, CreateBackup:=False
End Sub
A client exports a file out of Crystal reports to Excel. Then, they go to
Tools...Macro and run a couple of very simple macros that are shown below.
Now, they are going to be getting rid of the computer that runs this and are
moving this report along with Excel to a new server where they will continue
to use this "programming".
I need to recreate all of this. I have upgraded the Crystal report and I
have the Excel macro, obviously. What I don't "get", is how this client has
been able to export the data from one application (Crystal) to an Excel
template or spreadsheet or csv file or whatever and allow for the macro to
just "be there" without being overwritten by the data exported from Excel.
You see, I'm sure that the macro programming is saved on an Excel template
somewhere where the client runs the two macros. But, how is the data
exported to this Excel file without overwriting the macros embedded in the
file?
Any ideas? If I can figure this out, then I can recreate this template and
save it on the server. Thanks!
childofthe1980s
Sub CrystalRpt2()
'
' CrystalRpt2 Macro
' Macro recorded 8/22/2005 by ewest
'
'
ActiveCell.Offset(0, 6).Columns("A:B").EntireColumn.Select
Selection.NumberFormat = "0"
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "x"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "x"
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlUp).Select
ActiveCell.FormulaR1C1 = "=+RC[-3]*1"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=+RC[-3]*100"
ActiveCell.Offset(0, -1).Range("A1:B1").Select
Selection.Copy
ActiveCell.Offset(1, 0).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Windows("Template.csv").Activate
ActiveCell.Offset(0, -5).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("checkspaid.xls").Activate
ActiveCell.Offset(0, 6).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("Template.csv").Activate
ActiveCell.Offset(0, 3).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("checkspaid.xls").Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("Template.csv").Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Windows("checkspaid.xls").Activate
ActiveCell.Offset(0, -2).Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Windows("Template.csv").Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub
Sub PosPay082305()
'
' PosPay082305 Macro
' Macro recorded 8/23/2005 by ewest
'
'
Columns("A:A").Select
Selection.NumberFormat = "@"
Selection.ColumnWidth = 12
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("B:B").Select
Selection.ColumnWidth = 1
Columns("C:C").Select
Selection.ColumnWidth = 2
Columns("D").Select
Selection.NumberFormat = "0000000000"
Selection.ColumnWidth = 10
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("E:E").Select
Selection.NumberFormat = "000000000000"
Selection.ColumnWidth = 12
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("F:F").Select
Selection.NumberFormat = "mmddyyyy"
Selection.ColumnWidth = 8
ActiveWorkbook.SaveAs Filename:="K:\Users\B of A Positive
Pay\Template.csv", _
FileFormat:=xlCSV, CreateBackup:=False
End Sub