VBA problem after Excel update?

  • Thread starter Sören_Marodören
  • Start date
S

Sören_Marodören

Hi,

I have a VBA script that I use to convert CSV-files from a TDS1014
oscilloscope.
With this script I can open a CSV-file, convert it with the macro, and then
open
another CSV-file to convert, and so on.

But sins two weeks this does not work.
If I open a CSV-file, run the script and then open another file, the
information is automatically sorted into different columns. But not in the
way that I want.
So now I have to fist open all files that I want to convert, then run the
script,
file by file.
If I then want to convert another file, I have to close down Excel completely
and start it up from scratch.

I have not changed the script sins October 2007 and I have not done anything
in
the Excel setup. So it must have to do with some of the latest updates.

Has anyone else seen something like this?

Best regards,
/Sören


--- The script ---
Sub Read_Osc_data()
' Reformat column 1 to many columns
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5,
1), Array(6, 1)), _
DecimalSeparator:=".", TrailingMinusNumbers:=True

' Remove header information
Range("A1:B16").Select
Selection.ClearContents

' Copy data to column 1 and 2
Columns("D:E").Select
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

' Format old header
Range("B1:B15").Select
Application.CutCopyMode = False
Selection.NumberFormat = "General"

' Remove old data
Columns("D:E").Select
Selection.ClearContents
End Sub

--- Example from a CSV-file ---
Record Length,1.024000e+03,, 0.00000, -7.74850,
Sample Interval,1.233033e+01,, 12.33033, -5.34850,
Trigger Point,0.000000000000e+00,, 24.66067, -12.14850,
,,, 36.99100, -18.94850,
,,, 49.32134, -18.14850,
,,, 61.65167, -18.54850,
Source,MATH,, 73.98201, -24.54850,
Vertical Units,dB,, 86.31234, -57.34850,
Vertical Scale,1.000000e+01,, 98.64268, -72.54850,
Vertical Offset,0.000000e+00,, 110.97301, -61.34850,
Horizontal Units,Hz,, 123.30335, -56.94850,
Horizontal Scale,1.262626e+03,, 135.63368, -46.94850,
Pt Fmt,Y,, 147.96402, -45.74850,
Yzero,-3.494850e+01,, 160.29435, -45.34850,
Probe Atten,1.000000e+00,, 172.62468, -49.74850,
Firmware Version,FV:v6.08,, 184.95502, -74.94850,
,,,197.28535, -69.34850,
,,,209.61568, -65.34850,
,,,221.94601, -57.34850,
,,,234.27634, -46.94850,
,,,246.60667, -45.74850,
,,,258.93700, -46.14850,
,,,271.26733, -46.14850,
,,,283.59766, -42.94850,
,,,295.92799, -41.74850,
,,,308.25832, -41.34850,
,,,320.58865, -48.54850,
,,,332.91898, -41.74850,
,,,345.24931, -38.94850,
........
 
J

Jim Cone

Sören,
Take a look at this post...
http://tinyurl.com/37dvav
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)




"Sören_Marodören"
wrote in message
Hi,
I have a VBA script that I use to convert CSV-files from a TDS1014
oscilloscope.
With this script I can open a CSV-file, convert it with the macro, and then
open
another CSV-file to convert, and so on.

But since two weeks this does not work.
If I open a CSV-file, run the script and then open another file, the
information is automatically sorted into different columns. But not in the
way that I want.
So now I have to fist open all files that I want to convert, then run the
script,
file by file.
If I then want to convert another file, I have to close down Excel completely
and start it up from scratch.

I have not changed the script sins October 2007 and I have not done anything
in
the Excel setup. So it must have to do with some of the latest updates.

Has anyone else seen something like this?

Best regards,
/Sören


--- The script ---
Sub Read_Osc_data()
' Reformat column 1 to many columns
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=True, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5,
1), Array(6, 1)), _
DecimalSeparator:=".", TrailingMinusNumbers:=True

' Remove header information
Range("A1:B16").Select
Selection.ClearContents

' Copy data to column 1 and 2
Columns("D:E").Select
Selection.Copy
Columns("A:A").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

' Format old header
Range("B1:B15").Select
Application.CutCopyMode = False
Selection.NumberFormat = "General"

' Remove old data
Columns("D:E").Select
Selection.ClearContents
End Sub

--- Example from a CSV-file ---
Record Length,1.024000e+03,, 0.00000, -7.74850,
Sample Interval,1.233033e+01,, 12.33033, -5.34850,
Trigger Point,0.000000000000e+00,, 24.66067, -12.14850,
,,, 36.99100, -18.94850,
,,, 49.32134, -18.14850,
,,, 61.65167, -18.54850,
Source,MATH,, 73.98201, -24.54850,
Vertical Units,dB,, 86.31234, -57.34850,
Vertical Scale,1.000000e+01,, 98.64268, -72.54850,
Vertical Offset,0.000000e+00,, 110.97301, -61.34850,
Horizontal Units,Hz,, 123.30335, -56.94850,
Horizontal Scale,1.262626e+03,, 135.63368, -46.94850,
Pt Fmt,Y,, 147.96402, -45.74850,
Yzero,-3.494850e+01,, 160.29435, -45.34850,
Probe Atten,1.000000e+00,, 172.62468, -49.74850,
Firmware Version,FV:v6.08,, 184.95502, -74.94850,
,,,197.28535, -69.34850,
,,,209.61568, -65.34850,
,,,221.94601, -57.34850,
,,,234.27634, -46.94850,
,,,246.60667, -45.74850,
,,,258.93700, -46.14850,
,,,271.26733, -46.14850,
,,,283.59766, -42.94850,
,,,295.92799, -41.74850,
,,,308.25832, -41.34850,
,,,320.58865, -48.54850,
,,,332.91898, -41.74850,
,,,345.24931, -38.94850,
........
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top