Visual Basic for Applications Animated text - excel

when I open my excel, macro command run automatically and show "welome".But i want to design it little bit.Is there any way i can change its colour size or text box. below my screen shot. [Its not utmost important but I love to know can i animated this text.]
IMAGE LINK
https://msexcel-analysistabs1.netdna-ssl.com/wp/wp-content/uploads/2013/01/run-a-macro-automatically.png

Are you just calling a standard msgbox in VBA? If so, instead of calling a msgbox, you can create an actual UserForm in Excel VBA. From there, place a label in the "box" and you can format the font in a variety of ways: colors, size, text font, etc.
You cannot do any "fun" animations as far as I know. But you can definitely change the font size and color!
Here is an example (I'm not the most creative person)
You do this under the VBA Project Explorer -> Insert -> Userform. From there you add Labels/Buttons/Whatever objects you would like, and resize the form if you so choose. Then in your module/macro, you call this form instead of using a msgbox.

As far as changing the color and size of the text, Yes, you need to create a UserForm and create the 'Welcome' screen as a custom form instead of using VBA's msgbox.
In VBA, right click on the workbook in the Project Explorer.
Select Insert->UserForm.
Design how you'd like the Welcome screen to display.
In ThisWorkbook's Workbook_Open() sub, put UserForm.Show() to display the custom welcome message when the workbook first opens.
As far as animating said text, Not really. There are some convoluted workarounds using an embedded webbrowser object in order to render a custom animated text javascript file. It is full of 'Potential Risk' notifications for the user and really doesn't look very good. Sorry to burst your bubble :).

Related

Possible to show the same object (textbox that display a menu when) with the same name and referencing the same macros/vba code?

I have emulated a hamburger menu (implemented as a textbox) that triggers a dropdown with various options that I want to display various tabs of an Excel workbook (though the specific purpose of the textbox is not relevant to my question). Is it possible to show the same textbox object (or any other object) with the same name and calling the same macros/vba code? I would like to avoid having to write a separate [tbName]_click, etc. event handlers for the each tab where I want it to appear (and will eventually want to have the hamburger menu displayed on various pages dynamically -- but that's a subject for another day).
Thx...
D.
The code for the hamburger menu (for which I already have working code) is implemented as a textbox ,but could be ANY object that triggers a macro when clicked. I don't think posting that code would be helpful. I have not yet begun witing code to place the copies of the object on different tabs. Before I begin writing that code, I was simply hoping for guidance on an APPROACH.-- not so much the code to do so as much as either a verbal description or even simple pseudocode showing how to copy the object from a source tab to a new or different target tab. That, and whether the object, after being copied to the target tab, can have the same name and trigger the same macro. There are other behaviors I want the object to display, but I can figure those out myself, and there's no need to bring them up here.

How do I allow user to select, but not edit, text in an excel userform control whose width is smaller than the text?

Context
I want the user to review some selections they made earlier. So I display some text describing each selection on a separate control in a userform. Some of the text on the controls is long, extending beyond the width of the control. This is fine; I just want the user to be able to see all of the text without being able to edit it. To do this, I use textboxes that are "Locked" (i.e. not editable) but "Enabled" (i.e. selectable). This way, they can just click and either mouse-drag or arrow-key over to scroll through all the text.
Problem
The (small, aesthetic) problem is that when the user clicks in one of the textboxes, they get a blinking cursor, which is misleading as that is normally associated with an editable textbox.
Possible solutions
Ideally, there would be some way of removing the blinking cursor, while still allowing selection but not edition. However, I'm open to other alternatives that don't have to do with changing the width, or having a scrollbar (the textbox is too short to fit a scrollbar). The best alternative I have so far is changing the background color to a gray to make it slightly more clear that it's not editable.
P.S. I'm very familiar with VBA, so if that's part of the solution, I'm cool with that.
Thanks all!
I had a similar issue, and solved it by using these instructions to create a hidden textbox that the cursor automatically appeared in (invisible to the user).

VBA output dialog/window or similar in Excel (2010)

I've little experience with VBA and Office applications.
My goal is to export data from an Excel sheet to another application. But before the export happens, I want a popup dialog or similar to appear when the user presses the "Export"-button, so he/she can review the data which will be ecxported. The reason for this is that the exported data is from various places in the sheet (or sheets), so a visual review is a good idea.
MsgBox is, of course, to small. And it's not meant for presenting lots of data.
What's a practical/elegant/effective/easy way of doing this? Ideally the popup window with the preview shoul have a "Go ahead"-button too, but this is not strictly necessary.
You have to open Visual Basic editor. On menu, choose "Insert" -> "User Form". Then you can create custom user forms with text fields, labels, check boxes, buttons etc. Here you can find basic informations.

Grid control that can be placed on userform?

Does anyone know of a grid control that can be placed on an Excel UserForm, preferably something that is capable of displaying the content of a ADODB Recordset?
In VB window using 'Tools'->'Additional Controls' menu, there may be DBGrid control; check it.
In the VB window, using 'Tools->Additional Controls, there is a 'Microsoft Office Spreadsheet 11.0' control that is very powerful. This is true for Excel 2010, at least. Don't know about more recent versions.
Just throwing this out there for anyone that might be interested. I too as looking for a way to display what looks like a grid on a userform. Since I'm working on a shared program with different users having different versions, I shied away from the "Additional Controls.
Very simply, what I did was throw a number of labels into a frame, got rid of the borders, separated them with just the tiniest space in between and set the back color of the frame to a darker color. The result is below.

datagridview layout behaviour

I have c#/2008/winform application.
I have a form with a picture banner, and a datagridview below it
I want the picture banner to remain fixed in size, and the datagridview to rezise
and fill the rest of the form.
I have set the picturebox to dock=top
(Also pos=0,0, sizemode=centerimage - but these setting are not the problem)
My datagridview misbehaves no matter what i do
If i do dock=fill, it starts from the top of form, and is obstructed by the picture
If i try to set dock=bottom it does not resize with the container
I am aware of the concept of layoutmanagers but this is just a quick app
so i hope i dont need one here.
Any ideas ?
thank you
There may be a better workaround but the first thing I found that worked was to introduce a panel control.
Make you picture box Dock=Top, then place the panel below it with Dock=Fill, then your DataGridView goes inside the panel with Dock = Fill.

Resources