473,231 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Caption of command button not displaying until clicked.

88
I hope that this is the right forum. I'm using VB to create a report in Excel. After the report is generated I put two buttons onto the title sheet. Both are for printing a part of the report. Here is my code;

Expand|Select|Wrap|Line Numbers
  1. button1 = ApExcel.ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
  2.         , DisplayAsIcon:=False, Left:=119.25, Top:=217.5, Width:=110, Height:= _
  3.         24).Select
  4.  
  5. ApExcel.ActiveSheet.CommandButton1.Caption = "Print Summary Report"
  6.  
  7. button2 = ApExcel.ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False _
  8.         , DisplayAsIcon:=False, Left:=119.25, Top:=285.75, Width:=110, Height _
  9.         :=24).Select
  10.  
  11. ApExcel.ActiveSheet.CommandButton2.Caption = "Print Full Report"
  12.  
The buttons get put on the worksheet ok, and they work. The only thing is that the caption of the button does not display until the button is clicked. Instead it displays the button name. (CommandButton1, and CommandButton2), as soon as it looses focus it goes back to the button name.

This just looks really bad in the report. Any ideas what I'm doing wrong?

Thanks
Franccesca
Sep 10 '07 #1
1 2017
... the caption of the button does not display until the button is clicked. Instead it displays the button name ...
I don't have a solution but a suggested debug step: put a messagebox after the caption assignment. See how VBA sees the caption button.
Also, is there some kind of refresh mechanism for your form? I know there is in VB6.
Sep 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: mksql | last post by:
New to Tkinter. Initially, I had some code that was executing button commands at creation, rather than waiting for user action. Some research here gave me a solution, but I am not sure why the...
9
by: Randall Sell | last post by:
Can anyone confirm if I am being an idiot, or is this a bug in the CSS implementation of Netscape 7.x/Mozilla 1.4 ... give the following single HTML: <html> <head> <style type="text/css">...
2
by: Colin | last post by:
I have a main form with a command button on it that when clicked, opens a subform displaying records that relate to the main form. I would like to disable the command button if the corresponding...
3
by: Paul Hodgson | last post by:
I have quite a few pages that have multiple command buttons on them - for example one button might be to logout, and others might be to display different segments of the data being shown. The...
1
by: Peter Rilling | last post by:
I have an interesting problem with a datagrid. It is the standard chicken-and-the-egg problem. I have this page with two datagrids. It essentially defines a parent-child relationship. The...
2
by: jerryemmanuel | last post by:
I have to display a command button with a long caption in two lines.. <input type="button" value="I have display the caption of this command button in 2 lines" > I tried using <BR>, "\n" but...
2
by: jerryemmanuel | last post by:
I have to display the caption of the command button in 2 lines .. I tried using <input type="button" value-"I am going to dispaly the command button caption in two lines"> But it did not...
2
by: erasmus | last post by:
It seems that in some cases the callback (command) function in a TkInter Button runs automatically when drawn for the first time. Example: b=Button(frame, text="Click me",command=myFunction())...
10
by: sierra7 | last post by:
I'm trying to create a form where a user enters a document reference number and then clicks a command button to add a hyperlink to the document, via a file picker. Thanks to Adezii's excellent...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.