VBA Best Method: Make UserForm Fill The Screen
Good Day All,
In VBA, can you make a UserForm fill an entire screen without specifically indicating a Height & Width measurement?
I have code to get the User's video mode (i.e. 640x480;800x600;etc.), and was thinking to adjust the Height & Width of the Form based on the video mode dimensions, but is there an easier way to go?
Thanks In Advance, LadyA
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
VBA Best Method: Make UserForm Fill The Screen
G'day,
Re:
Quote:
Originally Posted by herilane
Dim OldState As Integer
OldState = Application.WindowState
Application.WindowState = xlMaximized
Me.Top = Application.Top
Me.Left = Application.Left
Me.Height = Application.Height
Me.Width = Application.Width
Application.WindowState = OldState
End Sub[/vb]
I tried to use this in my workbook, but I get the following message:
Quote:
Compile Error:
Invalid use of Me Keyword
Do you know why this is not working? (I included your code in Module1 and tried to call it from a button that loads the first menu; however, I had to declare the procedure as public - is this where I have gone wrong?)
Thanks,
Mitchys
Fill More Then 0ne Combobox In A Userform
Hello.
I'd like to fill 4 comboboxes on a userform. The problem is i don't know how to loop through the 4 combobox object.
Thanx in advance.
Werner
my code:
Code:
Private Sub UserForm_Activate()
Dim cmb As ComboBox
Dim cmbo() As ComboBox
fileGrootBoek = "C:XXXXXurenverantwoordingGrootboek.xls"
qry = "SELECT nr, grootboek FROM `Grootboek$`"
'get a handle on all comboboxes
For Each cmb In frmGrootBoek
Set cmbo(i) = cmb
Next
'counters
i = 0
j = 0
'Fill form with values from excel sheet
Call test
'Execute query
Set result = Gegevens.QrySelect(fileGrootBoek, qry)
'Fill comboboxes wich are named: cmbGB1, cmbGB2, cmbGB3 and cmbGB4
'First empty combobox
For Each cmb In frmGrootBoek
cmbo(j).Clear
'code to fill combobox
Do While (result.EOF = False)
cmbo(j).AddItem (result.Fields(1))
cmbo(j).List(j, 1) = result.Fields(0)
j = j + 1
result.MoveNext
Loop
Next
'close recordset
result.Close
Set result = Nothing
End Sub
How To Add The .Line Method To A UserForm
Hi, I'm using the TransPicBox UserControl posted by DanCool999 in Threat .
I added it to my project. Now I need the Line method for that Control, how do I add that?
UserForm Hide Method In Excel
I usually write code in C/C++, but was given a little job that I have to do in VBA in Excel. I'm not too familiar with VBA (don't really want to be, either), so I ran into a little problem.
I want to display a user form showing a little message, and then close it. If I call the Hide method, nothing happens. This is what it looks like:
Load PrintNotify
PrintNotify.Show
.
.
.
Sleep(1000)
PrintNotify.Hide
The Sleep API call is there in case the code in between the Show and Hide calls is executed too fast. All this code is within the same function. I've tried unloading the form and setting it's Visible property to False. Nothing works. Any clues, anyone?
Thanks,
-- Rubio
UserForm - Select Method Of Worksheet Class Failed
I have a macro I run after loading a UserForm and it gives me a Run-time error '1004': Select method of Worksheet class failed.
Here is the line where it crashes:
Code:
Sheets("Data").Select
I don't have a problem when I run the sub when the userform is closed only when it is open.
Any ideas why this would happen?
Updating Screen With UserForm
I'm writing a VBA code for an excel workbook I wrote for my Job. The Workbook will receive, in real time, data from electic power values, that are being generated in the Power Plant, and will draw these Operation Points on a ChartSheet (That will change each time the values are read). I intend to have this Chart displayed as figure in a UserForm in the Plant Control Room. That works already fine for individual points, but when I tried to try out the code, changing values through a For Next loop to see the Figure (image from the Chart) changing also in real time, I got the screen only one time updated. Only for the last value in the loop "For Next" . I tried to use Application.ScreenUpdating=True and False without success. Could anyone Help me? Is this possible?
Code in UserForm (simplified):
-----------------------------------------
Code:
Private Sub UserForm_Activate()
For reativo = 150 To 0 Step -1 ' Reactive Power in MVAR
Worksheets("Ponto de Operação").Range("D11").Value = reativo
UpdateChart
Next reativo
End Sub
Private Sub UpdateChart()
Dim oCht As Chart, lPicType As Long
Set oCht = ThisWorkbook.Charts("Curva capacidade")
lPicType = xlPicture
With oCht
.CopyPicture xlScreen, lPicType, xlScreen
End With
Set Image1.Picture = PastePicture(lPicType)
End Sub
------------------------------------------------------
Thanks in Advance
Cnevas
Adjusting Cell Size To Fill Screen
I have a worksheet where I increase & decrease cells widths/heights to give the effect of zooming into a sheet. The first time the sheet appears I'd like to set it to the maximum so that the content fills the screen. In other words, if there are 10 useable columns, and 20 useable rows, I'd like the right-most visible cel to be col 10 (or 9), and the bottom most visible row to be 20.
So, to calculate the cell width that would give the desired effect, I divided the ActiveWindow.width by the number of columns to be viewed. The result I get is way to big. Is this a units issue? (cell width is in different units than ActiveWindow.width?) What am I doing wrong.
Make My Own Error Userform
I tried to make my own userform that I can show the error message I whant. In the code I have wrote this: on error goto initfeil
in the initfeil the code is like this:
Dim dlgfeil As feilboks
dlgfeil.settfeilforklaring ("Initsierings feil mot database, kritisk. kontakt systemadministrator")
dlgfeil.settfeilerrobj(err.Description)
set dlgfeil = Nothing
In the userform feilboks ther are two public sub function descreib below:
Public Sub settfeilforklaring(t As String)
feilforklaring = t
end sub
Public sub settfeilerrobj(t As String)
feilerrobj = t
end sub
I get the run-time error '424' Object required
WHY HEEEEELP
Make Progress Bar Fill Over Time?
I want to make a (fake) progress bar fill over the period of 15 sec. Its just for looks so I figured I would use a timer, but it doenst let me use a + sign. Please tell me how.
UserForm Textbox, Make Input Be UPPERCASE Only?
If there's a will, there's a way, right?
Can a UserForm text box be made to only accept entries that are made with the Upper Case only?
if input is in lower case, then I'd need an error message box stating that the capslock is turned off, please turn on and make entry.
Thanks for everyone's attention to this question =)
MDI Noob - How To Make Child Fill Parent MDI?
Hi all
This is my first post and also my first MDI app.
I usually write console apps or work on the backend stuff so I'm a bit lost when it comes to MDI apps.
I've been writing an app which I initially started using multiple forms. I now realise that I need to utilise a generic menu system accross all of the forms and so have decided to make it into a MDI app.
I've got all the forms pretty much designed but when I load them into the MDI form, I can't get them to fill the parent?
Also, because it was initially written as a console app with <<Back and Next>> type naviagtion buttons, I need to ensure that only 1 form will be displayed at a time and in the right order (hope to maintain the "walk-through" type feel to the app).
Am I on the right track even using an MDI approach???
Anyone got ANY suggestions?
Cheers
Wayne
How To Make Error Messages If Details Not Entered On Userform??
Hi,
I would like to know how in a userform where i have an insert button, that when i click that button it checks to see what details have been entered and if something isnt entered then a box pops up and says that you have not filled in these fields. please complete the information. then it doesnt do anything more untill you have reentered all the information.
Also how do i make it so that in a txtarea on the userform that the user can only enter numbers.
Please let me know what to do soon.
thanks
Kristofor
Quick Q: Fill 0 In Front To Make 4 Digit String
hi
Say I have a number: 15
How would I add 0s in front so it looked like this: 0015
... but so it also works if I have a numbers like:
1 >> 0001
100 >> 0100
8888 >> 8888
Thanking you in advance
cheers
nathan
Screen Method
using ACCESS as a database and currently have some code behind to calculate the current screen size (x,y).
Depending on the size of the monitor on which the computer is running the size of the boxes or positions are smaller/different.
I have one line of code which looks like this:
OLEUnbound0.Left = (Screen.Width - OLEUnbound0.Width) / 2
the code falls over when it reaches Screen.width.
When i type it, the intelisense does not pick up width either.
However i have used the screen method before in another VB application.
Thanks
Jim
Wouldn't This Code Fill In All Forms? Doesn't Make Sense
It doesn't make sense why this code wouldn't work to fill in all 8 forms on the page...
VB Code:
For x = 0 To 8WebBrowser1.Document.All.Forms(x).Value = "hey"Next x
You know? Is it possible that im doing something wrong here?
Alternertive Method Of Screen.TwipsPerPixelX ?
In my VC program, I want to know how many Twips( unit of printers ) equal to one Pixel. In VB, I can use Screen.TwipsPerPixelX and Screen.TwipsPerPixelY. But how can i get the information in VC?
In MSDN, I have found a method:
int GetDeviceCaps( HDC hdc, int nIndex );
which may help me. But I do not know how to get the HDC of my display monitor. Can anyone help me? Many thanks!!!
[Cakkie: moved from VB Forum to VC]
Disable Ctrl+alt+del For And Ctrl+tab In Login Screen And How To Make A Screen
how i can disable Ctrl+alt+del for and ctrl+tab in login screen
accept user can put the correct username and password to login
to the desktop
and how i can make one screen to close the desktop,
just give user only can put they password and
username (textbox)can unlock the screen.coz what i
do before this is just using form to display all the screen,
so when i logoff or switch user, i still can c the taskbar,
and using Crtl+del+alt to close the form.....
Make An Object Method A DDE Source
My client has an Excel sheet that has DDE links to a PLC application. For example, in one of the cells the forumula is:
CODE=kepdde|_ddedata!kps_serial.plc.count1
Using A UserForm As A "Splash Screen"
I have tried to implement a "Splash Screen" at the start of an Excel project, following the suggestion on pages 447 -449 of John Walkenbach's "Excel 2003 Power Programming with VBA".
This puts
Code:
Private Sub Workbook_Open()
UserForm1.Show
End Sub
into the "ThisWorkbook" code,
and
Code:
Private Sub UserForm1_Activate()
Application.OnTime Now + TimeValue("00:00:05"), _
"KillTheForm"
End Sub
into the code for UserForm1
Another subroutine is placed in any other module in the project:
Code:
Private Sub KillTheForm()
Unload UserForm1
UserForm2.Show
End Sub
However this doesn't work.
I have fallen back to the simple method of adding a ControlButton to unload UserForm1 and show the next UserForm. This does work OK.
I would still like the Splash Screen (UserForm1) to disappear after 5 seconds by itself, so how do I do it, please ?
Pause Vba Userform, Manual Intput In Excel And Then Again With The Userform ??
hello you all, It's me again
I have had many probs, but the most are gone now, thx to you guys.
Next problem is this:
I use userforms to collect data from files and also user entries.
After a while the user should be able to enter some data manualy in the sheet, but the userform should be still active, because there are some global and other values i would like to keep.
Is it possible??
I would like to put some pause button in vba-userform and on the sheet a button to continue.
Thx 4 the help
Fill Listview Then Double Click To Fill Text Boxes (Resolved)
Hello
I have been working on this project off and on for about 6 months. What I am trying to do is use a text box search and fill a list view with the results. Then select the one I want and have it populate some text boxes on another form. all the fields can contain alpha numeric characters. I have attached the program. If any one can help me it would be greatly appreciated. I have been trying various combinations but have had no success.
Thanks
Bob
Edited by - Bob Taylor on 7/29/2003 4:08:49 PM
Is It Possible To Make Shades Of Colour Inside A Region..fillrgn Method? Etc
In my program , its a land generator, anyway ive just changed all the coding to make it way more efficient then it was before, so it generates faster
but one problem is my last version could do shades of colours as i was using the line function to draw the landscape, by using the lines i could change the colour bit by bit so it would make shades of colours
now im using create poly region method and the fill region method
i was wondering if there is someway to make shades of colours either using the fill rgn or something else
below are the two land generations
Make The Screen Greyscale.......
I need to make (at the click of a button) what ever is on the screen look as if it's on a black and white monitor........a bit like windows xp does when it shows the shutdown options dialog
Is this possible in VB?
Edit by moderator: Before you post a new thread, please take a moment to choose the right sub-forum, instead of just posting in General. Thank you.
How To Make The Screen Scroll?
im not sure if this is the right place to post this but eyah... cna any one tell me or help me on how to amke it so the screen scrolls across?
like the character alwasy stays in the middle of the screen? thx
How To Make It Full Screen?
I am now starting to write a RPG, however, I don't know how to make it in full screen mode under windows. Can anyone help me?
How To Make Testfile Pop Up On Screen?
hi...I have a simple qn here which I need help on...
My VB program allows values in textboxes to be written to a file called testfile in my :C drive. I would like this testfile to pop up and appear centrally on the screen whenever I click on a command button. Whats the simplest code to achieve that?
Many thanks
Make A Attractive Screen
how to make the screen more attractive. And why i cannot package the sistem for animation. I use user control.
How To: Make A Login Screen
Ok.
This is how it is.
I'm not such of a expert on VB so please forgive me if this is a noob question:
I've already got some Forms wich get their data from a Access Dbase.
I want to make a program wich starts with a login screen that gets the loginname and password from the Access Dbase.
Does somebody know how tot start the program with the login screen and what the code is for the login screen to get the data out of the access Dbase?
Thnx very much in advance.
How Do You Make A Screen Saver?
Can anyone tell me how to make a screen saver? I want to make a cool looking screen saver for my site. Source code and/or attachments will be appreciated
How Do I Make A Splash Screen?
How, How, How, I have tried so many different things to get it to work but just cant seem to get it right.
I want something for my program like when VB starts or adobe Starts
I want a form to show up and display a splash screen while a form in the back loads, when the form or the main part of the progrm is finished the splash screen dissapears and unloads
Code samples please. The Closest I have come to Simulating it doesn;t work very well and it is just simulating
Closest I have come to it
Code:
Private Sub Form_Load()
SplashScreen.Show
SetLoadEnvironment
Pause (8)
SplashScreen.Hide
Unload SplashScreen
End Sub
I know it is not the correct way I just can't see to figure it out. Help please
How To Make A Screen Saver.
How can I make a screen saver? without having to open my program, but a REAL screen saver? Oh, and if you have the time, how do I change my modem speaker volume?
Thanks!
Steve
How To Make A Screen Saver.
How can I make a screen saver? without having to open my program, but a REAL screen saver? Oh, and if you have the time, how do I change my modem speaker volume?
Thanks!
Steve
How To Make Print Screen
hi all
i want to ask you
how i can make print screen in vb code not by pressing printscreen
ayman
Trying To Make Screen Saver In VB6
I have it done. When I run it, it shows up full screen and plays sounds just fine in VB6 design mode. I complied it as a .SCR and put it in Windowssystem32 When I pick it from the Windows Desktop, Properties, screen savers, it runs just fine in preview mode too.
But when Windows times out and it loads a screen saver it just shows up as a minimize form, half way up the screen, the Sounds play Ok.
If I double click the form it only takes up a quarter of the screen.
Is this some Service Pack 2 issue trying to stop .scr files from running?
I’ve made screen savers in the past and they worked just fine.
DougP, MCP, A+
Make A Dog Walk Around The Screen
Hi,
Please tell me how to make a picture (let say the picture of a dog, at the same time, the legs of the dog are moving, just look like walking) walk around the screen and at the same time, there is an active window (VB form)running. I do not want the dog "bother" what the program user working on the active window.
How To Make A Splash Screen Work?
how can I make a splash screen work? for example, the splash screen comes up when i starts the program, stays there for 4 seconds, then it goes away, then the mainwindows comes. does anyone knows how I can do that?
Make Splash Screen Available To All New Excel
Can anyone advise me if it is possible to make a splash screen appear everytime someone opens a Excel document.(New and Existing files)
I already have a splash screen which i imported into a workbook and this loads ok when i open this particular Excel file.
The reason for this is that the company would like to display a logo everytime anyone opens Excel.
Thanks .........Paul
How To Make A Screen Saver Maker?
I want to make a screen saver maker that will accept swf files. The difficult part is how do you set a windows screen saver in VB?
Thanks
How To Make A Full Screen Screenshot
hi everybody
im working on this little application for myself... when its done i want it to take screen shots of the entire screen at a given time. like every hour for example.
right now im still stuck on the fist part. how to you take a full screen screen shot? anyone know? i know the crtl + PrtSc option, but i want to make an application which can do it by itself.
so far i only found
public sub command1_Click()
Me.PrintForm
End Sub
but thats no use as it only takes a picture of the application. i need the whole screen.
please help. have been trying to figure out for days...
thanks in advance!!
How To Make A Notepad File Pop Up On Screen?
hi...I have a simple qn here which I need help on...
My VB program allows values in textboxes to be written to a NOTEPAD file called testfile in my :C drive. I would like this testfile to pop up and appear centrally on the screen whenever I click on a command button. Whats the simplest code to achieve that?
I used
Shell "C:/testfile.exe"
Shell "C:/testfile.txt"
Shell ("C:/testfile.exe")
Shell ("C:/testfile.txt")
all of which did not work
Many thanks
How Do I Make An Options Screen/menu?
I want users to be able to have an option screen, which would allow them to change the background, cursor, etc, and save their changes into registry. I can easily make an options screen/menu, but the saving part is what I need help with.
|