How to Keep Excel Sheet Formatting On a CSV Sheet with vba

Joined
Aug 14, 2022
Messages
2
Reaction score
0
Good morning to all my name is Maurizio and I am a new member.
My Problem and this :
I created with an excel sheet a routine that saves me in my subfolder a file in csv format;
And so far so good.
but I saw that if I only open the saved file, that file has all the data in one cell.
Therefore I was wondering if there was no system because all data cannot be entered into a single cell.

Beyond its formatting.
All this always using the vba code. That's all Thanks
Greetings from A.Maurizio
Image_File_Desiderato.png
 

Attachments

  • Esporta_File_Csv_3.zip
    35.8 KB · Views: 9
Last edited:
Joined
Aug 14, 2022
Messages
2
Reaction score
0
Ciao a tutti scusatemi se qualche giorno fa avevo inserito questa mia richiesta
ma ha forza di provare le svariate soluzioni
Sono riuscito a risolvere questo mio problema , creando questa :

Hello everyone excuse me if a few days ago I entered this request of mine
but he has the strength to try the various solutions
I managed to solve my problem by creating this:

[CODICE]
Sub ScriviFile()
In caso di errore Vai a terminare

Dim Nome_File come stringa
Dim Percorso come stringa
Dim Zona_Dati come stringa
Dim Estensionw Come String

Dim CellaD come stringa

Dim UltimaC finché
Dim UltimaR finché

Dim NewWb come cartella di lavoro
Imposta NuovoWb = Cartelle di lavoro.Aggiungi

Nome_File = Foglio1.Range("N2").valore & ""
'Estensione = Fogli di lavoro("foglio1").Intervallo("O2").valore
'Percorso = ThisWorkbook.Path & "\Allegati\" & Nome_File & Estensione
'Zona_Dati = Fogli di lavoro("foglio1").Intervallo("A2:D17").Copia
dt = Formato(Ora, "gg-mm-aaaa")


ThisWorkbook.Worksheets("Sheet1").Range("A2:D17").Copia destinazione:=NewWb.Worksheets(1).Cells(1)

NewWb.SaveAs Nome file:=ThisWorkbook.Path & "\Allegati\" & Nome_File & " " & dt & " " & ".csv", FileFormat:=xlCSV, _
CreateBackup:=Falso, locale:=Vero
cella = “”


'MsgBox "Ciao!!!", vbInformation, "Attenzione"

MsgBox "Estrazione esguita", vbInformation, "FINITO"

finire:
Bene sub
[/CODICE]

Ora però quello che vorrei solo più risolvere e questo
:Quando viene salvato il file in CSV viene rinominato con la dicitura che inserisco nella Vella (N2)
Però se apro in un secondo momento questo file , noto che tale dicitura viene anche usata per rinominare il foglio in CSV
Come si può vedere in questa immagine .

Mentre io vorrei prendere il nome che inserisco nella Cella (P2)
Come posso risolvere questo problema !

Grazie per tutto l'aiuto che vorrete darmi in merito
Saluti da A.Maurizio

But now what I just want to solve is this

: When the file is saved in CSV it is renamed with the wording that I insert in Vella (N2)

But if I open this file later, I notice that this wording is also used to rename the sheet in CSV

As can be seen in this image.



While I would like to take the name I enter in the Cell (P2)

How can I solve this problem !



Thank you for all the help you will want to give me on this

Greetings from A.Maurizio
 

Attachments

  • Rinomina_Foglio.jpg
    Rinomina_Foglio.jpg
    94.8 KB · Views: 9
Last edited by a moderator:

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