Results 1 to 3 of 3

Problem saving file as .csv

Threaded View

  1. #1
    Registered User
    Join Date
    07-04-2016
    Location
    Santiago, Chile
    MS-Off Ver
    2010
    Posts
    2

    Problem saving file as .csv

    I need to save some sheets in the workbook as .cvs.
    When I do it manually it saves the file as .cvs and when I open the file it shows the data in columns but when i do it with a macro it saves the file as .cvs but when I open the files it shows the columns in one column with commas as separator.

    This is my code so far:
    Sub Crea_Libros_Cargar()
    ' se encargara de recorrer todas las hojas
    Dim W As Integer
    'variables para las rutas
    
    Dim Nombre, RutaGuardar As String
    Dim Nombresuc As String
    Dim Nombrecd As String
    
    Nombresuc = InputBox("Sucursal")
    Nombrecd = InputBox("CD")
    
        'creo un ciclo for recorriendo todas las hojas del archivo actual
        For W = 1 To ActiveWorkbook.Sheets.Count
                'activo la primera hoja
                Sheets(W).Activate
                'asigno el nombre de la hoja a la variable
                Nombre = ActiveSheet.Name
                Sheets(Nombre).Copy
                
                RutaGuardar = "C:\Users\carolina.urra\Documents\Distribucion\Sugerido Distribucion\MACRO\" & Nombresuc & Nombrecd & Nombre & ".csv"
                '
                
                ActiveWorkbook.SaveAs Filename:=RutaGuardar, FileFormat:=xlCSV, CreateBackup:=False
                
                ActiveWindow.Close Savechanges:=True
        Next
        MsgBox ("proceso finalizado exitosamente") _
    , , "Finalizado"
    End Sub
    Can someone please help me to save the files the same way when I do it manually.

    Here its what I Get when i record the saving process:
        Sheets("1").Select
        Sheets("1").Name = "1"
        Sheets("1").Select
        Sheets("1").Copy
        ActiveWorkbook.SaveAs Filename:= _
            "C:\Users\carolina.urra\Documents\Distribucion\Sugerido Distribucion\MACRO\Libro24.csv" _
            , FileFormat:=xlCSV, CreateBackup:=False
        ActiveWorkbook.Save
        ActiveWindow.Close
    Last edited by carocat; 07-04-2016 at 01:55 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problem saving ppt file from vba
    By sbe70 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-13-2016, 09:32 AM
  2. [SOLVED] Problem with Saving .csv file as excel file
    By dreindorf in forum Excel General
    Replies: 3
    Last Post: 02-10-2016, 06:59 PM
  3. Problem saving Excel file that copies an embedded object from a separate file
    By bhodge10 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2012, 02:47 PM
  4. Excel file saving problem
    By frulhaque in forum Excel General
    Replies: 1
    Last Post: 06-14-2009, 03:59 AM
  5. Problem saving file
    By ssim in forum Excel General
    Replies: 1
    Last Post: 04-27-2007, 01:41 AM
  6. Problem saving excel file
    By bsimo49 in forum Excel General
    Replies: 4
    Last Post: 08-06-2006, 05:55 PM
  7. problem when saving CSV file
    By mhe in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-05-2005, 04:06 PM

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