Save tab-delimited file to .IIF, not .TXT?

ElBombay

Board Regular
Joined
Aug 3, 2005
Messages
196
I've written a program that creates an upload file for Quickbooks but QB only recognizes the IIF extension. I have to manually copy *.TXT to *.IIF before QB will load it. Can Excel export the tab file with the IIF extension instead?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
What kind of program is this?
If it is VBA, you can program the file renaming part right into the VBA.
If you post your VBA code, we can help you do that part.
 
Upvote 0
What kind of program is this?
If it is VBA, you can program the file renaming part right into the VBA.
If you post your VBA code, we can help you do that part.

Thanks. Here is the relevant bloc of code. It will obviously need memory variables to accommodate dynamic bottom-rows and filenames. We've got almost 100 statements to load and not a lot of to for cut & paste. Another client taken by surprise by the approach of year-end.

/*
'--------------------------------------------------------------------------------------------
Sub IIF_Create()
'
' Export reformatted data per QB specs
' 12/8/21
'
Save file
Range("A1").Select
Selection.End(xlDown).Select
Range("A1:I144").Select
Range("I144").Activate
ActiveWorkbook.SaveAs Filename:= _
"C:\Finances\QBooks\25SEP21B.txt", FileFormat:=xlText, _
CreateBackup:=False

End Sub
'--------------------------------------------------------------------------------------------
*/
 
Upvote 0
It looks like that is what you are telling it to do, right in your code.
Just try changing thie line:
Rich (BB code):
"C:\Finances\QBooks\25SEP21B.txt", FileFormat:=xlText, _
to this:
Rich (BB code):
"C:\Finances\QBooks\25SEP21B.iif", FileFormat:=xlText, _
 
Upvote 0
Solution
It looks like that is what you are telling it to do, right in your code.
Just try changing thie line:
Rich (BB code):
"C:\Finances\QBooks\25SEP21B.txt", FileFormat:=xlText, _
to this:
Rich (BB code):
"C:\Finances\QBooks\25SEP21B.iif", FileFormat:=xlText, _
Thanks. Fresh eyes and a clear mind. I couldn't switch to IIF when recording the macro; the Dialog Box just tacked .TXT on to my [name].IIF. I had tunnel vision about changing it in the code.

As I was wos,figddlingg with the problem (including some pretty dense code by the board member Stacker) I tried the NAME command. This problem is solved but for future refence, do you see why the code below bombs at the starred line?


/*
Sub VBA_Name_Function_Ex1()

Dim sFileName1 As String, sFileName2 As String

sFileName1 = "C:\Users\Jim Gleason\Finances\QBooks\25SEP21B.TXT"
sFileName2 = "C:\Users\Jim Gleason\Finances\QBooks\25SEP21B.IIF"

** Name sFileName1 As sFileName2 **

End Sub
*/
 
Upvote 0
Thanks. Fresh eyes and a clear mind. I couldn't switch to IIF when recording the macro; the Dialog Box just tacked .TXT on to my [name].IIF. I had tunnel vision about changing it in the code.
Yes, while the Macro Recorder can be a great tool to get you started, it often requires a little bit of editing after completion to make the code more dynamic and streamlined.
I usually consider it a "starting point"; seldom is the recorded code a good finished product.

As I was wos,figddlingg with the problem (including some pretty dense code by the board member Stacker) I tried the NAME command. This problem is solved but for future refence, do you see why the code below bombs at the starred line?


/*
Sub VBA_Name_Function_Ex1()

Dim sFileName1 As String, sFileName2 As String

sFileName1 = "C:\Users\Jim Gleason\Finances\QBooks\25SEP21B.TXT"
sFileName2 = "C:\Users\Jim Gleason\Finances\QBooks\25SEP21B.IIF"

** Name sFileName1 As sFileName2 **

End Sub
*/
Your code worked just fine for me. What kind of error message do you get? What exactly does it say?
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,755
Members
448,989
Latest member
mariah3

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