Batch file opening Excel file and Macro - excel

I want to create a batch file which when I run this file, an excel file should open with some columns in it.
Say if I click on batch file, excel file with columns name, project, ID should also get included in excel file.
Also with this a macro should be open.
Please help. I dont have any idea about this.

I don't think it is possible to automate excel with pure batch.
Why not:
Create an "template" excel file with the default columns and macro included
Have a batch file copy this template (copy template.xslx newfile.xslx) file and open it (`Start newfile.xslx).
For the new file, you'd either have to generate a random or timestamp-based name or have the user enter the name before making a copy.

Related

Copy sheet(s) from one excel file to another excel file

I have an excel sheet that is opened and I want to copy some specific sheets from target excel file into the file that is opened.I want to have
A field to define the path of target excel file.
A field to define the name of the sheets to be copied.
A button to execute the command.
Can someone one give me source code or a place where I can get the help regarding the required functionality or best if there is file with macro.

How to Combine Multiple Excel into one with Talend

I'm a new in Talend and need some help.
I want to write data in the same excel file containing different sheets, I have 2 tFileOuputExcel, I put the same file name and different sheet names,
In output the data is written only in the first sheet but not in the second sheet.
Below is the screenshot of my job.
You can use tFileExcel-Components 13.3 by Jan Lolling on Talend Exchange. We have been using it in our project without any issues. You can use
tFileExcelWorkbookOpen - to open excel file (blank template file)
tFileExcelSheetOutput - to write to each sheet of the workbook opened above.
tFileExcelWorkbookSave - to save the excel file
in 2nd tFileOutputExcel select checkbox "Append Existing File"

VbA to save a TXT formated copy of excel sheet

I am trying to make a macro to save data from a sheet of an excel document to a text file.
I am using the following which does produce the file I need:
ActiveWorkbook.SaveAs Filename:="Rate File.txt", FileFormat:=xlTextPrinter
The problem is I want this new saved file to be independent/a new file where it is currently renaming the current excel workbook and treating the new saved file as if it's part of the workbook. So you can't open or use the text file because it says it's open in the excel workbook.
I tried the below code :
ActiveWorkbook.SaveCopyAs Filename:="Rate File.txt", FileFormat:=xlTextPrinter
but get an error because it will not let you format it anymore. The savecopyas part though is making an independent file like I want it to, but makes a file that is just jiberish and can't be used for anything.
Is there a way to save an independent copy but still have it formatted as the txt file type? Thanks!

How to combine multiple Excel files?

I have multiple Excel files in the same format and I want to combine them into a single file.
How can I merge them into one single excel file using VBA?
VBA is no longer required to merge files. You can use Power Query and merge all files in the same folder with just a few clicks. When the files change, you just update the query.
You have two choices:
a "flat" file, in which all the data are in a single sheet (BAD)
A multi-sheet file (GOOD)
In the first case open a new file, cut and paste your existing content into the new (single) sheet
In the second case Move/Copy the sheets to a New Document.
There: you now have enough Google fodder to get you started.
I had this same issue a while back and found an excellent solution thanks to my good friend Google. All credit for this solution goes to the following page: computer hope
To merge Microsoft Excel files together, save them as CSV files first (it would be possible to automate this part in VBA if there is a recurrent need). Open the Excel files and in the menu bar, click File, then Save As. In the Save as type drop-down list, select CSV (comma delimited) (*.csv) from the list.
Do this for each Excel file you want to merge, then place all the CSV files in the same folder. For ease, place them in a folder in the root of the C: drive (e.g., c:\csvfiles).
Open the Windows command prompt (to get to this, in the Search or Run line, type cmd and press return) and navigate to the folder containing the CSV files. Type dir to view the files in the folder and ensure all the files are there.
Type in the following command to merge all CSV files in the folder into a new CSV file titled "newfile.csv" (any name could be used):
copy *.csv newfile.csv
After the new file is created, open the new CSV file in Microsoft Excel and save it as an Excel file.

Access two excel files using single macro

I have macro, using which i am trying to open a excel file then make some validation in the file that is opened. And Open another excel file and put the validation results(of excel file 1) in the form of report in the 2nd Excel.
So the task i have to do here is:
Open Excel file 1
Script to validate data in excel file 1.
Open Excel file 2
Enter the results in it.
Here i am able to open two excel files but not able to create pointers to them. Such as
if i use Sheets("Sheet1").Range("A1").value 'this picks data from Excel file 1.
But to access Excel file 2 what do i need to write, is this something like this:
Sheets("!Sheet1").Range("A1").value
Please help me to fix this. Thanks.
Application.Workbooks("create-a-macro").Worksheets(1).Range("A1").Value = "Hello"
Visit http://www.excel-easy.com/vba/workbook-worksheet-object.html

Resources