Excel file should access another excel file with macros - excel

I am trying to write a macro in an excel file, that can access another excel file where the "real" code is. So the excel file with the original macro code will be updated from time to time and I want the other excel file to always get access to the updated code while running a macro.
Does anybody know how to write a macro, that can access the vba code of another file?
I am a beginner in vba and don't really know where to start…
Thank you! :)

Related

How to copy an active excel sheet and save it into a new workbook using a vbs script?

I'm trying to copy an excel sheet that includes formulas and paste it into a new excel workbook as values and retaining the format using vbs script.
I'm currently doing it but instead of copying I'm saving it as a CSV.
So it is only saving the first page but it looses the format.
Please help.
Thank you.
I found a way around to fix this, I run a vbs to refresh and save the file. then with a batch file i run another script and open the file to only run a macro inside of it and the macro does the job.

How to write a patch to Excel VBA codes?

I've written an algorithm in Excel VBA to process Excel data. After I handed the Excel file to the client, I found some bugs in the codes. How can I write a fix/patch then hand the patch to the client for easy install? Assume that the client has no knowledge of coding in VBA and cannot even open VBA editor.
Way1:You can import his sheets from old file to new, then kill old file.
Way2:Replace code in old file from new file.

Run a batch process on Excel files and edit VBA code

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 :-)

Running an Excel Macro in Task Scheduler

I currently have an Excel Macro saved in the personal workbook that I would like to run when opening a file with the task scheduler. Right now I am able to get the workbook to open and then it cannot find the macro that it is trying to run. I am using the "/x MACRONAME" Argument to try and run the macro currently and I am afraid that I can't figure out the correct name. I have tried just using the macro's name and PERSONAL.XBLS! followed by the macro's name. I feel like I am missing something very obvious and any help would be appreciated.

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