Good day,
My Google-fu has failed me as I've searched and am unable to locate the information I require.
I have a master workbook, when it is ran, it will create another workbook based on cell values and the master closes and remains unchanged, the new workbook is then used to store information and is saved to an Archive folder when the workbook is closed. This archived workbook can be opened in future to edit or resend data but if the master workbook is opened it starts all over as blank and as stated creates a new workbook again.
It has 5 modules, 14 userforms and also uses code in ThisWorkBook and some save codes on different worksheets throughout.
When I update something, like add or modify a userform, I email the change out to 13 different emails and attach the master workbook which they download and replace it and carry on. The workbook has to remain as one file and has to run without internet access as they're MS Surfaces that are used in an outside work environment and internet access is not always available.
I have found some things regarding this but they usually only export and import bas.
I would like to know if anyone knows of a way or a source to update all the modules and userforms in workbooks in Archive.
The user will download the master from the email, replace the previous and when it is ran it will pull the updated forms and code from it and export them to the older workbooks in the Archive folder so the new additions can be used in the older workbooks. I also require that the information on the worksheets in the old workbooks remains unchanged.
The master would need to update multiple workbooks at first run, then not run again until the next update when it replaced again. I can do this by using a cell value like if A1 = 1 then don't run for example.
I haven't tried anything yet as I only found the bas export, importer as stated.
I apologize for my wall of text and I hope I am clear on my scope.
Thank you for your time.
Related
The Problem
I have an Excel workbook that prompts the user for some actions every time it is opened.
This same workbook contains charts that are linked in a PowerPoint file. These links were created by copying the charts in Excel and then, in the PowerPoint file, clicking "Paste Special", choosing "Paste Link", and selecting "Microsoft Excel Worksheet (code) Object" as the link type.
Every time the PowerPoint file is opened, I am prompted to update the links in the document.
The trouble is that, while PowerPoint is updating links, the Excel prompts that are intended for the user are shown and have to be clicked (multiple times) during the link update process.
Is it possible for my VBA code to detect when it's being opened for the purposes of updating links so I can skip the user prompts? I should note, in case it matters, that I'm using Microsoft Office 365 on Windows 10.
What I've Tried
I've tried monitoring the value of ThisWorkbook.ReadOnly, Application.Interactive, and Application.IsSandboxed during startup, but they all appear to have the same values regardless of whether the workbook is opened for the purposes of updating links or not. I'm not familiar enough with how link updating works to know what else to check for.
I've identified a couple of possible work-arounds:
First, if the Excel workbook is opened before PowerPoint is opened and the link update process starts, then the prompts don't appear. This will work, if there's no better solution.
Second, I could create a second "shadow" Excel workbook with charts generated from data in the first spreadsheet, but without user prompts. If PowerPoint links to the charts in the "shadow" workbook, then links are updated without issue. This is far from ideal because of the need to keep the two workbooks in sync.
I'm hoping for an elegant automated solution.
I have an Excel document that is used by everyone in the office. When someone is in it the rest use a read only or have to wait to update. I have created a new workbook that references the working copy. Eg cell contents are =path[document]Sheet!cell is there a way to automatically view changes as they are input on the working copy. This would be a read only solution but ideally a right up to date copy of the working workbook. A solution through excel or VBA button click would be ideal. Can you help. I have tried connections but it crashes and only updates on a close and save from another user. When I have both docs open on my computer updates are instant.
Is it possible to link two workbooks in Excel and have the links remain intact if I change the name of one of the workbooks? I am constantly updating the name of one of the workbooks to reflect it's version number (i.e. I change Workbook_v1.xls to Workbook_v2.xls when I make progress on it). Anybody out there know if there are any workarounds to make my links in the unchanged workbook stay intact when I change the name of my other workbook?
Here is my sumif that I am using to get information from another workbook.
=SUMIF('[Workbook_v1.xlsm]Sheet1'!$A$1:$A$10,$D$1:$D$10,'Sheet3'!$B1:$B10)
You can see the problem I have if I change the name to Workbook_v2, the link is no longer supported. Thank you for any insight you may have!
I have a master workbook containing a macro which opens another workbook containing a demand forecast. The workbook opened through the macro is downloaded from a customer portal and is all new every day without possibility of editing it beforehand.
The macro then loops through the information and creates new readable and more intuitive worksheets. However, on a few of these worksheets I would like to add some event-driven code to give tooltips when mousing over or selecting cells.
Is there any possibility (without installing add-ons from vanilla Excel 2010) to add code to worksheet objects created during a macro?
The layout of the processed workbook is more or less static, so I was wondering if I should create a template file and then copy the input into it. That would allow me to have coded the events before data is added. Is this the best possibility?
As Dan pointed out, you could use Application.VBE.ActiveVBProject to programmatically add code modules to a workbook. But doing this requires more lenient Macro security settings (which are set to untrusted, by default) and this is not recommended.
When I have to do something similar, I use three workbooks:
The data containing workbook
This book has no macro functionality
A template workbook containing the necessary macros
A macro enabled workbook to facilitate the transition.
Use workbook #3 to open workbook #1 and copy its data into workbook #2. Save a copy of workbook #2 and close it. Repeat this process as necessary.
It isn't the prettiest solution, but it keeps your code modular.
Currently we have a Excel VBA application, which consists of 25-30 Excel sheet (and all of those sheets all hidden and we do background processing on them and display it to VBA forms UI), and we have developed a UI using VB forms. But problem we are facing is whenever we click on Save button using this code:
ThisWorkbook.Save
But this saves entire workbook not an individual sheet, so even if we make changes in single sheet it saves entire workbook and this save processing makes very slow (since it needs to save all excel sheet containing lot of data unnecessary, even if there is no changes).
My question is is there any way we can save "only one sheet in a particular excel sheet" not an entire excel file?
Note: I am a Java developer and I worked on VBA before, But it was years back, and I have forgotten bit. Any guidance would be appreciated. Or any pointers on how to handle this situation would be appreciated. Please let me know if you need any more information, I can edit this question.
What I have tried already? I did a lot of research from yesterday, I searched in previous questions on SO, but didn't get any useful information. As per my research it says we cannot do this. Am I on right path?
The short answer is no. You cannot save a single worksheet at a time.
You may want to try to reduce the amount of data in the workbook. Try storing data in several workbooks and when it is needed, open that specific workbook, make the needed changes, and then close it.
If it is necessary to have access to all data at once then consider using access or some other database.
It is also possible that the sheets have "blank data". Cells that don't contain anything in them but excel thinks they do so when saving it tries to save way more than needed.
Assuming that it is the active worksheet that you want to save then you could do something like this:
ActiveSheet.Copy
ActiveWorkbook.Close True, "path"
This copies the active worksheet which creates a new workbook which will become the active workbook. Then just call the close method on that and give it a file name.
I think you should consider splitting your application into multiple workbooks:
The workbook that contains all the logic, user forms and programming code. This workbook handles all other workbooks as well as the displaying of it. Potentially, this could be even an "Application Specific Addin", that stays dormant but activates as soon as any of it's subsequent workbooks gets opened. For this architecture approach check out the section on "Application Specific Addins" in this link.
This workobook/add-in can also hide the other workbooks, so that the user will not notice it's multiple workbooks.
One or multiple data workbooks: Depending how interlinked the data is, you can separate this, e.g. in a "Sales data" workbook which contains the large database, as "Base data" workbook, that contains all the smaller data (e.g. products or stores tables).
This way, you can reduce the saving to the "relevant" sheets. However, of course this requires quite a bit of reprogramming - but it's worth the effort, as for instance it also allows to provide updates/bug fixes without having the transfer the data between versions, as you only need to distribute the the file with programming logic. :-)