+ Reply to Thread
Results 1 to 3 of 3

Please help to get a macro to convert without format file to excel file.

  1. #1
    Registered User
    Join Date
    07-23-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2010
    Posts
    2

    Please help to get a macro to convert without format file to excel file.

    This is my first post on Excel forum.

    I want a macro that will open a without fiile in a folder and convert without format file whose name is like "cognos.701Z%27%5d&SA=propEnum,properties&ITEM=data&EA=&SS=queryOptions,options&dataEncoding=MIME&ES=&EM=" to Excel (.xlsx). Save excel file in same folder and delete above file.

    Please help on this.

    Thanks,

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Please help to get a macro to convert without format file to excel file.

    attach please a sample text file and xls file with desired result
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    07-23-2013
    Location
    Delhi
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Please help to get a macro to convert without format file to excel file.

    I am not able to upload file. Error - Invalid File.. I download file from Cognos tool and it doesn't have excel file extension. I am working on automation of that report. Rest part I have automated except starting part i.e. convert file in excel format. I have a code but its not working. Please find below.
    Sub Open_All_Files()
    Dim oWbk As Workbook
    Dim sFil As String
    Dim sPath As String

    sPath = "E:\Macro" 'location of files
    ChDrive "E" '-> if E is different than the current drive (if you didn't change it before, it is the drive where Office is installed)
    ChDir sPath
    sFil = Dir("*.*") 'change or add formats
    Do While (sFil <> "" And InStr(sFil, ".") = 0)
    NewFileName = sPath & "\" & sFil & ".xlsx"

    On Error Resume Next
    Name sFil As NewFileName 'Add extension to file

    Set oWbk = Workbooks.Open(NewFileName) 'Open file as XLSX

    'Do anything with the workbook

    oWbk.Close True 'close the workbook, saving changes

    sFil = Dir("*.*")
    Loop ' End of LOOP
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro to convert a txt file to excel file
    By vipin_pootheri in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2013, 08:11 AM
  2. Macro to convert decimal separators from US to EU format when loading a CSV file?
    By Knut Grossmann in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-18-2013, 04:01 PM
  3. Macro to convert comma delimited csv file to excel file??
    By sanjeevpandey in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-15-2012, 05:31 AM
  4. [SOLVED] Convert excel to different file format.
    By knothead in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2006, 09:10 AM
  5. How to Convert .lis file format in Excel
    By radhika07 in forum Excel General
    Replies: 0
    Last Post: 01-07-2005, 06:48 AM

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