Saving file with non standard extension

music_al

Board Regular
Joined
Nov 26, 2008
Messages
133
We have a system that creates files that are imported into Oracle. The files have the naming convention...
Filename.0000
... where the numbers are incremented with each export. So one file might be filename.4357 and the next file will be filename.4358 and so on.
Ive managed to import the file into a spreadsheet as a comma delimited file where I then carry out some cleansing of the file using VBA.
I then want to save the file back to this unusual type .0000 but I can only seem to save it as Excel, CSV, TXT, PDF etc.
Does anyone have any ideas ? Thank you in advance.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
We have a system that creates files that are imported into Oracle. The files have the naming convention...
Filename.0000
... where the numbers are incremented with each export. So one file might be filename.4357 and the next file will be filename.4358 and so on.
Ive managed to import the file into a spreadsheet as a comma delimited file where I then carry out some cleansing of the file using VBA.
I then want to save the file back to this unusual type .0000 but I can only seem to save it as Excel, CSV, TXT, PDF etc.
Does anyone have any ideas ? Thank you in advance.


Code:
      ThisWorkbook.SaveAs "c:\test.0000"
 
Upvote 0
Thanks Steve. That sort of works but it seems to do something crazy with the contents of the file.

The original file opens like a CSV file but the resulting file after doing the SaveAs has random character in it.
 
Upvote 0
Thanks Steve. That sort of works but it seems to do something crazy with the contents of the file.

The original file opens like a CSV file but the resulting file after doing the SaveAs has random character in it.

I have been messing around with this a bit. The only way to get it to work so far has been for me to save it in CSV format, and then afterwards, rename the file to strip the file extension from it.
 
Upvote 0
I want to close the file and then use the NAME function to change its name by removing the .txt from the end. I'm getting a subscript out of range error on the highlighted line.

Code:
Sub SaveAs_ARIS_File()


    Dim Original_Filename As String, New_Filename As String
    Original_Filename = Worksheets("Sheet1").Range("A1")
    Application.DisplayAlerts = False    'Turn off display alerts
    
    Sheets("ARIS Upload File (4145)").Select
    Sheets("ARIS Upload File (4145)").Move
    ActiveWorkbook.SaveAs Filename:=Original_Filename & ".txt", FileFormat:=xlText, CreateBackup:=False
    
    New_Filename = Original_Filename & ".txt"
    
    'I get an error on this line - Subscript out of range
[COLOR=#ff0000]    Workbooks(New_Filename).Close SaveChanges:=False[/COLOR]
    
    Application.DisplayAlerts = True    'Turn off display alerts
    
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,443
Members
448,898
Latest member
drewmorgan128

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top