.XLSM and set to automatic RUN-TIME - excel

We are quite new with this Excel VBA (.xlsm). We've managed to create a button and create VBA scripts to manipulate worksheet, etc.
Now my question is - how to set the RUN-TIME mode automatically when this Excel worksheet is open?
I don't see any property in "Application" associated with this.
I would appreciate your help.

Try the info in this forum.
http://www.thecodecage.com/forumz/members-excel-vba-programming/159321-macro-exit-design-mode.html
If working with Excel 2007, this code might help:
Application.CommandBars.ExecuteMso ("DesignMode")
-Source Link

Related

Cannot execute macro module

I am currently working on creating my own Ribbon in excel. I wrote out the specific code in a module in a macro-enabled workbook that I will subsequently save as an Excel add-in (.xlam). However, whenever I try to run the module in my macro enabled workbook, the select macro window appears and no code is executed (see picture for reference). Subsequently, I think this is what is also causing my ribbon button to give the following error when clicked "The macro may not be available in this workbook or all macros may be disabled."
Any help/suggestions would be appreciated. Thanks.

Editing excel online and in workbook

I have a vba code in my .xlsm excel file. When i edit it online, my code does not work. But it works when i have been editing it in Work book.
Why is this so?
The vba code contains a code for stoping duplicate value entry for a column in excel
Short answer is that you can open workbooks containing macros online but you can't do anything with the code.
Work with macros in Excel Online
Although you can't work with macros in Excel Online, you can open a
workbook that contains macros—though you won't be able to see the
macros. You can edit the worksheets and save a workbook containing
macros in Excel Online. The macros will remain in the workbook, and
you open the workbook in the Excel desktop application to view and
edit the macros.
Bottom line: Use Excel desktop application to work with macros.
You can vote for it as a feature here:
Developer tab, macros, custom add-ins for online Excel

Complex formatting error in excel (xlsm) 2010

I'm encountering the following error whenever I tried to run my xlsm in excel 2010.
Complex formatting that is applied to the selected chart may take a
while to display. Do you want to continue using the formatting?"
But my xlsm works fine in excel 2013 and excel 2016.
Please anyone suggest solution to resolve this.
If you have access to the VBA code, try writing the following in the Private Sub Workbook_Open():
Do
DoEvents
Loop Until Application.Ready()
Source: From here.

Can you refer to an external macro with excel?

I have a reasonably complex macro that I need to run on multiple different excel sheets, this macro is updated periodically and whenever a change is made its necessary to change it in each individual excel sheet. is there a way to get each excel document to refer to the one macro?
for example if i had a hierarchy like this:
DOCUMENTS:
-xlsheet1.xls
-xlsheet3.xls
-xlsheet2.xls
MACROS:
-macro1.bas
where there was a button in each sheet that ran macro1 when clicked.
I would recommend either moving that macro to your personal file or create an Add-In
Working with Personal File
Topic: Create and save all your macros in a single workbook
Link: https://support.microsoft.com/en-us/office/create-and-save-all-your-macros-in-a-single-workbook-66c97ab3-11c2-44db-b021-ae005a9bc790
Quote from the above link:
When you first create a macro in a workbook, it works only in that workbook. But what if you want to use the macro in other workbooks? To make your macros available every time you open Excel, you can create them in a workbook called Personal.xlsb. That’s a hidden workbook stored on your computer, which opens in the background every time you open Excel.
Creating an Add-In
Topic: Creating Excel Add-ins
Link: http://www.ozgrid.com/VBA/excel-add-in-create.htm
Quote from the above link:
I am often asked by users 'what is the best way to distribute their macros?' My answer, is without doubt via an Excel Add-in. After all, this is what Add-ins are for. For those that are not sure what an Excel add-in is, it's is nothing more than an Excel Workbook that has been saved as an Add-in, File>Save as \ Microsoft Excel Add-in (*.xla). Once saved and re-opened the Workbook will be hidden and can only be seen in the "Project Explorer" via the Visual Basic Editor. It is NOT hidden in the same way as the Personal.xls as this can be seen (and made visible) via Windows>Unhide.
The Personal file is good for having a macro across any number of workbooks on a single computer. In a networked environment with multiple users, you could simulate the Personal file by having a single workbook with your macros in it and coding all other workbooks to open and hide this workbook when they start up.

Excel 2003 protected worksheet, not allowing Excel 2000 users to use autofilter

I have created a spreadsheet for work and am trying to protect the sheet so that nobody except myself can edit the document. I have set it up so that I can edit the full range of the document. In the protection setting I have ticked the box that says that any users can use auto-filter.
I have the auto-filter set before applying the security so this is not the issue as many forums would suggest. However I am using Excel 2003 whereas the majority of the organization is using Office 2000. I can't help thinking that there is some incompatibility between the two systems. Can anyone advise? VBA macro's aren't really an option as the default setting within the organization is that only signed macros can run but even then they have to be verified by the end user (very annoying for users with a low IT knowledge).
Does anyone know of a way to make this work?
Does the organisation allow to change the default security settings within Excel for yourself and your users?
If not you can easily create your own macro signature. I think its an optional install component to Excel that allows you to create the signature based on your PC or username? This will not have the same standing as a full Microsoft verified signature but depending on the organisation's settings it might allow all your macros to be accepted.
This worked for me a few years ago on Excel 2000 but I still had to have each user change their security settings. I think I also made a macro to automate this change in security settings for each user? If I remember correctly.
This is solved now. we are all working on Office 2010.
It's not possible without VBA. See http://office.microsoft.com/en-us/excel-help/enable-autofilter-functionality-for-a-protected-worksheet-HA001098270.aspx
By default, the AutoFilter functionality in Excel becomes unavailable when you protect part or all of a spreadsheet. If you use Microsoft Office Excel 2003 or Excel 2002, you can restore that functionality manually. If you use Excel 2000, you need to use a few lines of Microsoft Visual Basic® for Applications (VBA) code.
Use VBA code to protect a worksheet and enable the AutoFilter
functionality in Excel 2000
The sample code shown here protects a worksheet (not a workbook) and
enables the AutoFilter functionality for that worksheet. The code
works only with Excel 2000. This particular sample runs automatically
when you open the workbook that contains the protected worksheet. The
code also contains a password that you use to unprotect the worksheet.
If you haven't already, start Excel 2000, open the desired workbook, and note the name of the worksheet that you want to protect.
On the Tools menu, point to Macro, and then click Visual Basic Editor.
In the Project Explorer, double-click ThisWorkbook.
A new, blank code module opens in the code window.
Copy the following sample code and paste it into the code window:
Private Sub Workbook_Open()
Sheet1.Protect password:="test", DrawingObjects:=True, _
contents:=True, Scenarios:=True, _
userinterfaceonly:=True
Sheet1.EnableAutoFilter = True End Sub

Resources