473,382 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Append record information to Macro output file name

I have a macro that is exporting records for a particular employee to an xls.
The default output filename is qryEmpItems.xls
Is there a way to have the macro append the employee name to the actual xls filename?

I'm looking for an end result such as qryEmpItems_EMPLOYEENAME.xls
Or better yet EMPLOYEENAME_Survey.xls

Not sure if this is a possibility.
Thanks!
Jan 9 '09 #1
5 2717
MindBender77
234 100+
@artemetis
I think the easiest way is to call an inputbox from your macro. I'm assuming your using transferspreadsheet. Add this to the file name argument:
Expand|Select|Wrap|Line Numbers
  1. ="c:\" & InputBox("Enter the employee name that's in the file name:") & "_Survey.xls"
  2.  
Hope this helps,
Bender
Jan 9 '09 #2
DonRayner
489 Expert 256MB
I don't think it's possible to do using a macro. Take a look at using the OutputTo command in VBA.
Jan 9 '09 #3
I'm trying that now, with some error.

I was using the OutputTo method.

When I use your approach, it errs out stating the file does not exist?

Ultimately, I'd like to have the 25 different files for each employee.
I don't mind the prompt box though.
:o)
Jan 9 '09 #4
MindBender77
234 100+
The syntax I provided for using the inputbox will work with "OutputTo" as well.

The arguements are:
Expand|Select|Wrap|Line Numbers
  1. Object Type: Query
  2. Object Name:  Name of Your Query
  3. Output Format: Microsoft Excel (*.xls)
  4. Output File: ="c:\" & InputBox("Enter the employee name that's in the file name:") & "_Survey.xls"
  5.  
HTH,
Bender
Jan 9 '09 #5
Yes it did!
Thank you!!!!
Jan 9 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jonathan Buckland | last post by:
Can someone give me an example how to append data without having to load the complete XML file. Is this possible? Jonathan
2
by: Rosy | last post by:
I am attempting to use the following code to print a report based on the current record in the form. Users bring up the record with a parameter box and then can make changes to the sub-form on the...
13
by: Lee | last post by:
Hello All, First of all I would like to say thank you for all of the help I have received here. I have been teaching myself Access for about 4 years now and I've always been able to find a...
4
by: MN | last post by:
I have to import a tab-delimited text file daily into Access through a macro. All of the data needs to be added to an existing table. Some of the data already exists but may be updated by the...
5
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
6
by: MarkoBBC | last post by:
Hi everyone, First a brief description of my form: I have a subform within a main form. In my subform, I have a listbox displaying address information by firm name. A user first has to select a...
6
by: jcf378 | last post by:
hello-- i am having trouble figuring out how to export individual records from an Access 2002 Form into a pre-existing Excel spreadsheet, such that the exported record is merely appended to the...
3
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
0
by: fahadq | last post by:
Hi I have a program that download files from the email and puts it into the corresponding folder. What i would like to know is how to sort and then appned if the file already exists i.e i get...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.