Create New XL Document using external text file in VBA

Is there a way in VBA to:

Open a new XL Document
Get external data (import text file)
Auto Format XL Document into Classic 1 format
Save XL document so I can email later
thayduckProgrammer AnalystAsked:
Who is Participating?
 
peter57rConnect With a Mentor Commented:
Which application will you be running this in (Access or XL?)
0
 
peter57rConnect With a Mentor Commented:
Does the text file import Ok when you do it by hand?
Is it a standard csv file?
0
 
thayduckProgrammer AnalystAuthor Commented:
I run this in a VBA to produce text file from Report1.
I wanted to automate the creation of the XL Document using this text file.
Even after doing this, there is some cleanup to do on the XL report.
Report is all summary total type stuff...

accessApp.DoCmd.OpenReport "Report1", acViewPreview
    accessApp.DoCmd.OutputTo acOutputReport, , acFormatTXT, _
        "C:\copy (2) of GVT\GVT Grain.txt"
0
 
thayduckProgrammer AnalystAuthor Commented:
Yes, the text file imports OK (some cleanup needed). Its a text file not csv.
0
 
thayduckProgrammer AnalystAuthor Commented:
In vba program within Access I already do:

1.  Run Access macro that builds Report1
 2.  accessApp.DoCmd.OpenReport "Report1", acViewPreview
    accessApp.DoCmd.OutputTo acOutputReport, , acFormatTXT, _
        "C:\copy (2) of GVT\GVT Grain.txt"

I want to add following into same vba program:
Open a new XL Document
Using 'Get external data' import Grain.txt file into this XL document
Auto Format XL Document into Classic 1 format
Save XL document so I can email later

 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.