I have a file which changes daily in a folder - but retains the same name so I can get SSIS to open that file without a problem. Because the file changes daily - the Macro needed to process it is resident in the System.XLSB workbook. How do I open the target file called Source.xls for arguments sake then trigger the Formatting macro in the SYSTEM.XLSB file to perform the actions on it? Any help greatly appreciated.
Related
I want to create a batch script that will take a .csv file that is tagged with a time stamp in the name open it, then open a specific macro-enabled Excel file (which will always be the same) and then run the macro in the 2nd workbook effective for the first workbook only.
So example:
BATCH:
for %%f in (PATH\*.csv) do ("C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE" "%%f")
I have this line to account for the changing time stamp
then the batch continues:
call PATH\Macro.xlsm
The CMD seems to stall after the first part and will not call the second file.
If I can have this open both files, can the macro run for all open workbooks rather than just the one it's built in via batch?
Any help would be appreciated as I am very new to this.
I need to make the same amendments to the VBA code in numerous excel files. The files are stored in a nested directory structure, with each file residing in its own folder, e.g:
-> Main Folder
-> Record No.
Excel File
The VBA code on each file is password protected (with the same password).
Is it possible to create a macro in Excel that could perform this operation? Or is it beyond the scope of Excel and VBA.
Thanks in advance for any help or advice on the matter.
Noel
on several excel files : use the FSO to get the names & folders of every file you need to amend
unlock VBA : workbooks.Unprotect
modify VBA : you can use the workbooks.VBProject.VBComponents object (modifying the code that is being runned may lead to crashes of course)
==> yes it is totally possible :-)
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
I'm trying to automate an ETL process in which a flat file (.xlsx) is placed into a folder and then a macro I built performs all the necessary transformations to the file. Right now I have to open the original .xlsx file then manually insert/run the macro (the macro saves and closes the file automatically). From here I have a program that automatically loads the transformed file into my db.
I was wondering what I could do to automate the inserting and running the macro step?
You need to save your workbook as an xlsm or xlsb file, as xlsx workbooks can't contain any vba code. After that, you can run your macro, either manually, or from a worksheet button.
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.