PDA

View Full Version : Batch script for inputting data into cells



willspill
01-03-2020, 05:28 AM
Hi,

I am trying to use a batch script to run my macro in Excel. I currently have it so the macro runs on opening the workbook, however, I was wondering if it was possible to write data into cells using the batch file as well. I have tried using the line:

"C:\Program Files (x86)\Microsoft Office\Office14\excel.exe" "M:\1\LayerImageMacro8.xlsm" /e(no_plots_run="8")(no_frames="10")(folder_path="M:\1\Example")(file_name="plot-001-")(input_file_type=".png")(output_file_type=".png")


Where no_plots_run, no_frames, folder_path, file_name, input_file_type and output_file_type are all named cells. However, this returns with the an error message saying that the file name could not be found. I am very new to this sort of thing and can't find anything online to help.


Any ideas?

Jan Karel Pieterse
01-03-2020, 06:49 AM
I would suggest to change your macro so it can read a text file containing those settings.

Kenneth Hobs
01-03-2020, 02:36 PM
What is the bat file for, a Windows Scheduled run? You could use a vbscript (VBS) file to do some things similar to VBA.

willspill
01-06-2020, 01:35 AM
Do you have any resources that show how to do this? I am not entirely sure where to start

willspill
01-06-2020, 01:40 AM
The macro layers images on top of eachother and exports them as a .png file. This is due to the business I work for having strict regulations on software downloading meaning I can't use traditional softare for this purpose. I need it in a batch file to do multiple images at once. Hope this makes sense.

Jan Karel Pieterse
01-06-2020, 09:07 AM
You mean you have multiple sets of images that need to be layered and exported? If so, you could place the iformation pertaining to those sets of images in a table and have your macro read the table.