View Full Version : Help with Macros


graham01
11-11-2005, 02:58 AM
Hello, can someone help me please?..I need to set up a macro to copy the contents of a certain query, open a specific excel file and copy the contents into it..i hope its even possible..

Many Thanks,
Graham.

FoFa
11-11-2005, 06:24 AM
If you just want to create a new XLS file each time, you can do that. If you want to actually OPEN a spreadsheet, and ADD data to it, I think you need to revert to VBA and Automation techniques.

graham01
11-11-2005, 01:33 PM
thanks for the reply, can you/anyone help me with it loading an already made XLS file? it has to be that it cant just create a new file

thanks

graham01
11-13-2005, 04:28 AM
ok it doesnt matter about the opening an XLS file, but is it possible to create a macro that copies everything in a certain query to the clipboard so it can be manually copied to the spreadsheet?

thanks,
Graham

graham01
11-13-2005, 12:02 PM
i've managed to get it to copy it to an already made spreadsheet, but it would help if it would load up the spreadsheet aswell after copying, does anyone know how i could do this?

thanks

FoFa
11-14-2005, 06:37 AM
I think if you use OUTPUTTO instead of transferspreadsheet it will open the application after it creates it. Hee is a line I use to do this:
DoCmd.OutputTo acOutputTable, TblName, acFormatXLS, FileName, True
TblName and FileName are variables I supply and I think the TRUE says start the applications, use HELP to see if this is what you want.

graham01
11-15-2005, 12:01 PM
thanks, I tried using outputto but i couldnt get it to copy to a spreadsheet without it wanting to overwrite the whole thing, is there a command i can use that i can add along with transferspreadsheet to open my spreadsheet? it would be really useful if i could create a macro thats basically just a macro since it can still open files that have been moved :confused:

FoFa
11-16-2005, 06:22 AM
The only way I know to ADD to an exiting spreadsheet is using VBA and Automation.

graham01
11-16-2005, 08:22 AM
ive already got it to add to an existing spreadsheet using transferspeadsheet, it even lets you choose which worksheet and cell to add it to which is really helpful :D but its just getting it to open the spreadsheet after which is annoying me

FoFa
11-18-2005, 06:25 AM
Try RUNAPP, specify Excel and feed the file name on the command line?

graham01
11-18-2005, 08:26 AM
thanks, i tried that before to to be honest i dont really know how to feed it the file *nOOb* can you help please?

FoFa
11-18-2005, 11:14 AM
I think on the run line it would be: excel.exe drive:path\filename.xls
basically