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.
Related
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! :)
I have an Excel Office 365 file that immediately crashes upon opening.
The file contains VBA modules that do not have a backup. I would like to extract the VBA modules without opening the file.
Is there a way to read the contents of the VBA modules and save them for reuse in a new file?
Kudos to Bigben , i opened excel in safe mode and was able to recover my code modules.
Although it does not answer the question i originally posed ie: is there a way to read the modules without opening the file", it achieves the same intent. Thank you BigBen
I am trying to develop a manner in VBA to track changes in a document without having to hide the contents in an extra sheet within a workbook.
I understand that if you change the extension of an Excel file to ".zip", you can access the Excel document as components sorted into directories. Is there a way to save and write to a text file within one of these directories so that I can access it every time the document is opened, without having to have the user drag a log file along with the Excel document?
Some facts:
When Excel opens the file, the file is blocked by Excel. There is no possibility to write to that file within VBA
You can store additional data into that file externally or after the Excel workbook has been closed
You would need to have code externally from the workbook to accomplish writing to that file after it has been closed. You may want to use VSTO or an oldschool Excel Addin.
you have to ensure that Excel will not destroy your changes when restructuring or repairing the file.
In the first run, your idea sounds very natural, to not use sheets from a programmer's point of view. You only have full control on Excel files when
you use external libraries (e.g. Spreadsheet Gear) or
you remote control Excel via automation.
you use openxml SDK for Excel
you use VBA
You could insert additonal information and take care that this information is not skipped by Excel.
When you want to do the tracking this way, I would suggest you to use an Excel Addin. There is actually no need for installation when using this kind of Addin. Attach to open workbook and close workbook events and ensure that all changes are written to the Excel Workbook after it has been closed. Certainly you would have to attach to all kind of other events to track all changes to the workbook. You may need to have in mind that there can be more than one workbook opened at a time.
Actually there are alternatives.
write your logging code in VBA or whatever fits
abstract away how your persist the code (e.g. use a data provider)
think about these two alternatives to store logging data:
You can save logging data in cells of excel. When using a "newer" version of excel, you have a limit of 1 million rows. You may want to implement a rolling mechanism that ensures that you never go over the border of 1 million records. (you may be dont want to track a million changes)
You can use the document properties to store you information as xml.
Last but not least, the most obvious: Why not using Excel's functionality of tracking changes? Understand track changes in Excel 2013
Say I have an Excel sheet. I add some programs to it (VBA) to make my workflow smoother. Then, after some time, I need another sheet which is very similar to the old one - especially because I want to use the same VBA program in it.
Is there a way to move the program from my old sheet to the new one save from copying the old sheet?
If you export the modules to a .bas file you could then import that code to any Excel sheet you needed it in.
It would also allow some customisation, as any changes you make after you import the module in will not have any effect on the original.
I have a report that I run from a system once a week, and the data is exported into an excel document. I have set up the tool that exports the data to excel to do a decent job on formatting, but there is still more that I need to do once the data is in excel.
Is it possible to create a stand alone macro, save it in a Microsoft office folder and be able to call it after I open this file? I have written plenty of macros that are part of ONE given spreadsheet, but never tried one that was open to many spreadsheets.
IS it possible, and a starting direction of good resources of where I can learn how to achieve this goal? Thank you.
...and be able to call it after I open this file?...
You have 2 very good options
1) Write and save your macro to Personal file. See this link for more information
Topic: Deploy your Excel macros from a central file
Link: http://office.microsoft.com/en-us/excel-help/deploy-your-excel-macros-from-a-central-file-HA001087296.aspx
Quote from the above link:
Have you ever wanted to use that really handy macro in all of your Excel worksheets? You can. This column explains how to place your macros in a file called personal.xls and make them available each time you start Excel.
2) Create an Add-In
Topic: Creating an Excel Add-in
Link: http://msdn.microsoft.com/en-us/library/aa140936%28v=office.10%29.aspx
Quote from the above link:
You create a Microsoft® Excel add-in by creating a workbook, adding code and custom toolbars and menu items to it, and saving it as an Excel add-in file.