+ Reply to Thread
Results 1 to 3 of 3

Reading Excel 2003 into Excel 2007

  1. #1
    Registered User
    Join Date
    06-21-2007
    Posts
    3

    Reading Excel 2003 into Excel 2007

    I have created an Excel spreadsheet that includes some small amount of VBA macro code to import and export files in Excel 2003. A user with Excel 2007 is telling me that when they try to load and run this spreadsheet in Excel 2007 they have problems.

    I've read lots of forum entries about going from 2007 to 2003 but I cannot find reference to problems and fixes going the other way. Can anyone help?

    Unfortunately I only have access myself to Office 2003 so I cannot see or test what happens on 2007 - I just assumed backwards compatibility.

    Thanks, Peter.

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Hi,
    can you post your code so that it can be tested in 2007?

  3. #3
    Registered User
    Join Date
    06-21-2007
    Posts
    3
    I can post the VBA code yes but I'm not sure if it is that or something else in the spreadsheet causing the problem.

    The ssheet has two buttons. The first activates "clear" and "import". The second is an "export" button. here is the associated code:

    Sub ClearCSV()
    '
    ' ClearCSV Macro
    ' Macro recorded 08/09/2008 by IBM_USER
    '
    Sheets("CSV File").Select
    Range("A1:M300").Select
    Selection.ClearContents
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "Your CSV File gets imported here!"
    Range("A1").Select
    Sheets("Bid Machine SSCT Reader").Select
    Range("A1").Select
    End Sub

    Sub ReadCSVFile()
    '
    ' ReadCSVFile
    ' Prompts for CSV File and imports contents to "CSV File" Tab
    '

    Dim StrThisBook As String
    Dim CSVFileName As String
    Dim FName As Variant

    FName = Application.GetOpenFilename("CSV Files (*.csv),*.csv", , _
    "Select CSV Data File")
    If FName = False Then Exit Sub

    Workbooks.Open Filename:= _
    FName
    StrThisBook = Application.ThisWorkbook.Name
    ' The next line sets the name of the selected CSV File
    CSVFileName = ActiveWorkbook.Name
    Range("A1:G300").Select
    Selection.Copy
    Windows(StrThisBook).Activate
    Sheets("CSV File").Select
    Range("A1").Select
    ActiveSheet.Paste
    Range("A1").Select
    Windows(CSVFileName).Activate
    Range("A1").Select
    Application.CutCopyMode = False
    ActiveWorkbook.Close
    Windows(StrThisBook).Activate
    Sheets("CSV File").Select
    If Range("B8") = "" Then
    Correct_Unformatted_CSV
    End If
    If Range("B8") = "" Then
    With ActiveSheet.QueryTables.Add(Connection:= _
    "TEXT;" & CSVFileName _
    , Destination:=Range("A1"))
    .Name = CSVFileName
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .RefreshStyle = xlOverwriteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = False
    .RefreshPeriod = 0
    .TextFilePromptOnRefresh = False
    .TextFilePlatform = 850
    .TextFileStartRow = 1
    .TextFileParseType = xlDelimited
    .TextFileTextQualifier = xlTextQualifierDoubleQuote
    .TextFileConsecutiveDelimiter = True
    .TextFileTabDelimiter = False
    .TextFileSemicolonDelimiter = False
    .TextFileCommaDelimiter = True
    .TextFileSpaceDelimiter = False
    .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
    .TextFileTrailingMinusNumbers = True
    .Refresh BackgroundQuery:=False
    End With
    End If
    Sheets("Bid Machine SSCT Reader").Select
    Range("A1").Select

    End Sub

    Sub Correct_Unformatted_CSV()
    '
    ' Correct_Unformatted_CSV Macro
    ' Macro recorded 04/09/2008 by IBM_USER
    '

    Sheets("CSV File").Select
    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
    TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
    Semicolon:=True, Comma:=False, Space:=False, Other:=False, FieldInfo _
    :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1)), _
    TrailingMinusNumbers:=True

    End Sub

    Sub ExportXLS()
    '
    ' SaveXLS Macro
    ' Macro recorded 03/10/2008 by IBM_USER
    '

    '
    Dim StrThisBook As String
    Dim StrThatBook As String

    StrThisBook = Application.ThisWorkbook.Name
    Sheets("Quote File").Visible = True
    Sheets("Quote File").Select
    Range("A1:M300").Select
    Selection.Copy
    Workbooks.Add
    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
    False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    StrThatBook = ActiveWorkbook.Name
    ' Cut & Paste Adjusted Price columns with formulas
    Windows( _
    StrThisBook _
    ).Activate
    Range("K10:M300").Select
    Selection.Copy
    Windows(StrThatBook).Activate
    Range("K10").Select
    Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    ActiveWindow.Zoom = 75
    ' Cut & Paste Total Columns F, H & J with formulas
    Windows( _
    StrThisBook _
    ).Activate
    Range("F10:F300").Select
    Selection.Copy
    Windows(StrThatBook).Activate
    Range("F10").Select
    Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Windows( _
    StrThisBook _
    ).Activate
    Range("H10:H300").Select
    Selection.Copy
    Windows(StrThatBook).Activate
    Range("H10").Select
    Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Windows( _
    StrThisBook _
    ).Activate
    Range("J10:J300").Select
    Selection.Copy
    Windows(StrThatBook).Activate
    Range("J10").Select
    Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("A1").Select
    Windows( _
    StrThisBook _
    ).Activate
    Range("A1").Select
    Application.CutCopyMode = False
    ActiveWindow.SelectedSheets.Visible = False
    Sheets("Bid Machine SSCT Reader").Select
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1