[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Create New XL Document using external text file in VBA

Posted on 2007-07-24
5
Medium Priority
?
693 Views
Last Modified: 2008-03-10
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
0
Comment
Question by:thayduck
  • 3
  • 2
5 Comments
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 375 total points
ID: 19558704
Does the text file import Ok when you do it by hand?
Is it a standard csv file?
0
 

Author Comment

by:thayduck
ID: 19558976
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
 

Author Comment

by:thayduck
ID: 19559030
Yes, the text file imports OK (some cleanup needed). Its a text file not csv.
0
 
LVL 77

Accepted Solution

by:
peter57r earned 375 total points
ID: 19568158
Which application will you be running this in (Access or XL?)
0
 

Author Comment

by:thayduck
ID: 19568493
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question