Preventing need to hit Enter twice in UserForm
With thanks to Harald who gave me this procedure which makes sure a number
is entered into a UserForm (and works great) .......
Q. Is there a way, that when the Enter key is hit, the userform accepts the
value entered without having to hit the Enter key twice?
Private Sub TextBox1_KeyPress(ByVal _
KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57
KeyAscii = 0
Private Sub TextBox1_KeyDown(ByVal _
KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
If Shift = 2 Then KeyCode = 0
Private Sub OKButton_Click()
Dim tax ...Equivalent to VB InputBox
I'm searching for an equivalent for Visual Basics "InputBox" function, to
prompt the user just for a String / CString.
Is there such a function based on Win32-API or in the MFC-Library? Or can I
load it from a DLL?
I don't want to write a class that inherits from CDialog and uses DDX for
this small task, am I forced to do it?
See this thread from the archive
Check Abdoul [ VC++ MVP ]
"Christoph Stoepel" <c_stoepelREMOVE_THIS@gmx.de> wrote in message
news:u...VB code help
Hi all, I am creating an application on Visual Basic 2008 to convert
any image into icon. I have written code (see below) which works
fine. It converts any image to icon in specified size. But the
problem is that when I try to use that icon I get error message
saying "invalid image property" or "invalid image" etc. Please can
any friend tell me that what amendments i need in my code below to
achive my objective. help in shape of code will be much appriciated.
Dim imageFinal As System.Drawing.Image = Nothing
Dim g As System.Drawing.Graphics = Nothing
imag...Visio - Visual Studio Architect vb.net
To Whom It May Concern,
I am looking for a Visio Diagram Buddy.
Casual Development of existing project,
explore internet collaboration
any country, english
This is driving me crazy; I hope someone can help.<br>
When I'm in the Visual Basic editor, if I press any letter that has a command key assignment, it performs that action as if Cmd were pressed - if I press "g", it opens the Immediate window. If I press "r", it goes to the Object Browser. If I press "s", it saves my document. It's impossible to actually type anything!<br>
This is only happening in the VB Editor, it's happening in the editor in both Word and Excel, and it happens whether it's in an existing file o...VB.NET: Writing attribute and Elements to Xml
Say i have this Xml file
how to create another automatic set of IDs and datas for the Xml tag so that
when i type in another set of data...
The content of the Xml file will become:
<...How to import text file into excel file using VB
How do I create a form with import button in excel file? The impor
button can perform the function of import the text file into
worksheet. Please give me some ideas of doing it.
I have attached a text file for your reference.
Attachment filename: rdata.txt
Download attachment: http://www.excelforum.com/attachment.php?postid=66226
Message posted from http://www.ExcelForum.com
How about recording a macro when you do it manually the first time.
Post back with followup questions.
"annsmjarm <" wrote:
> Ho...Userform #3
kann mirt jemand erkl�ren - wie ich diese auf den Desktop bringe und so ohne
start von Excel aufrufebn kann!
Danke f�r jeden Tipp!
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"Kiesel Bernd" <firstname.lastname@example.org> wrote in message
> Hallo zusammen
> kann mirt jemand erkl�ren - wie ich diese auf den Desktop bringe und so
> start von Excel aufrufebn kann!
> Danke f�r jeden Tipp!
...xml-export in vb.net
i try to create a little generic vb.net function for exporting access-tables
---===>>> CUT IN <<<===---
Function fncXmlExport(ByVal strDBpath As String, ByVal strTableName As
String, ByVal strXmlFileName As String)
Dim objDataSet As New System.Data.DataSet
Dim objXmlDocument As New System.Xml.XmlDocument
Dim objCmd As System.Data.OleDb.OleDbDataAdapter
Dim objCon As System.Data.OleDb.OleDbConnection
Dim strCon As String
strCon = "provider=Microsoft.Jet.OLEDB.4.0; data source=" & strDBpath
objCon = New System.Data.OleDb.OleDb...Define a range name using VB
I have a macro setup that imports and copies data from two source files into
an excel spreadsheet.
What I want to do after I have imported all of the information is to select
the data, and then define it as a name for use in a pivot table.
The code I'm using at the moment to slect the range (no matter the lenght of
' This will select all the current cells no matter the size
' of the data that has been imported
The number of fields is ...Need Simple XML help in VB.Net or C#
Hello and God Bless,
I am stumped trying to get a simple xml database replacing certain data
with other data programmatically. This is what my xml looks like.
...Question on Excel VB migrating to Office 2003
Newbie to VBA on Excel :-)
Inherited an Excel tool that no longer works in Office2003. Error is VB
"1004 - App or Object defined error".
Need to estimate effort is to migrate the tool from Office 2000 to 2003 - to
justify getting a resource. What has been changed to invalidate VBA?
Shouldn't it be backwards compatible?
Thanks - lc
I think you're going to have to post the offending line of code.
(or maybe check your references in both xl2k and xl2003 and compare the
differences--just a wild guess.)
> Newbie to VBA on Excel :-)
> Inherite...Use userform to get input and compare to a hidden sheet
I am using a userform to get employees id number and passwords. I have the
id numbers and passwords on a hidden sheet. I need to code in the submit
button on the form a way to search the hidden sheet for there id number and
password match and then if it does match take them to a specific sheet.
Should I be going about this in a different manner or is this possible?
First, worksheet protection is pretty easy to break. In just moments, everyone
can see your list of id's/passwords.
And the protection for the VBA project is easy to break so that users can see
your code, too.
...Inserting XML Data Into a New Table FROM VB.NET
Can anyone help me figure out how to insert data into SQL Server when
a table to hold the data does not yet exist. I am able to insert data
into a existing table in the following fashion. But what if the table
does not exist? Appreciate any help I can get.
Private Sub InsertData()
Dim objSQLConn As New
Dim objAdapter As SqlDataAdapter
Dim objDataRow As DataRow 'Dataset row
Dim objDBRow As DataRow 'SQL Server table row
Dim objDSXML As New DataSet
Dim objDSDBTable As...userform commnad from a sheet command
I have the following piece of code in Excel sheet 1 to trigger an event when
a cell content changes
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$4" Then
'This Code Runs When Cell A4 Changes'
What I want to do is insert here code to interrupt the running of a
particular userform and goto a particular point and resume that same
So something like
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$4" Then
goto userform 1line 220
...copy my vb project... is it as easy as copying the directory..
I want to take a copy of a project so I have two projects the same.. the
idea is i can play around with one, and not effect the original..
is it as easy as just using file explorer to copy the directory from say
c:\project1 to c:\project2... or do the project files like forms etc have
paths in them and therefore I can't just copy like this..
"AussieRules" <email@example.com> wrote in message
> I want to take a copy of a project so I have two projects the same.. the
> i...How do you move UserForm to Right hand side of screen with VBA?
The Userform usually come up in the center of the screen.
Given that different users have different resolutions on their screens how do
you move the Userform to the right hand side of the screen with it being
centered vertically no matter what the user screen resolution is?
Try this in the userform module
Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = (Application.Height / 2) - Me.Height / 2
Me.Left = Application.Width - Me.Width + Application.Left
Regards Ron de Bruin
<Dennis@NoSpam.com> wrote in ...change series color in Excel VB
Having created a chart with the VB chartwizard, I want to
control the colors of the series lines (not the
markers). Can anyone tell me how to do that? Below is
the basic code I am using. Using for example
..SeriesCollection(1).ColorIndex = 3
does not work.
Thanks in advance. DD
Dim ch As ChartObject
Set ch = Worksheets(wksh).ChartObjects.Add(0, 0, 700,
gallery:=xlLine, Format:=4, Title:=wksh & "
...Microsoft idea: don't change VB
I am probably just sparking another flame war but I thought this was
Anyone seen this blog post from a Microsoft developer who works on
VB.Net? Apparently one of the language features being considered when
planning the next steps for VB.Net is
"Don't add to (or change) the language. There's a good argument to be
made that we should just take a rest from changing the Visual Basic
SCENARIO: A new version of the language comes out, and every single
user is put through the hassle of upgrading their projects even if
they don't WANT to use ...Problem vertically aligning multiple rows with tickboxes added using VB.
I searched for days to find the solution to adding a column of
checkboxes down a table with 500 rows in it - a checkbox at the end of
each row. The good news is that I eentually found that someone had
posted a little VB code that did it nicely. I used some additional
conditional formatting and now each individual row changes colour when
the checkbox is ticked! It's a thing of beauty to a new user!
The trouble is that when you get 100 or so rows down the table the
checkboxes gets incrementally and noticeably out of alignment with the
rows. I guess that a tiny vertical ...Dispose of ADODB.Recordset with VB Express 2008
I've used the VB Express upgrade feature to transform code from VB6 to
VB Express 2008
Part of my original code included:
Dim RS As New ADODB.Recordset
Set RS = Nothing
RS.Open("SELECT DISTINCT GENUS FROM Plants ORDER by GENUS;", ogAccess)
The translated code included:
'UPGRADE_NOTE: Object RS may not be destroyed until it is garbage
collected. Click for more:
</Code...Updating a chart in a Userform
I want to have a Userform with a pie-chart on it that updates as th
user slides a slider around. In Access 2000 I seem to be able to inser
an Excel chart object to do this, but in Excel 2000, bizarrely,
So I'm looking for a workaround, and have tried using John Walkenbach'
less than perfect method described at:
The trouble with this is that you can see a Windows dialog box appea
for a brief second as the VBA is running. Is there any way of switchin
this off? I've tried using Application.ScreenUpdating = False, with n
lu...Shortcut key and UserForm
I want to use a shortcut key (Ctrl+z) to activate a UserForm but don't know
for sure it is possible or how to go about it. I've always used a Command
Button or a _Click() in the past. Any ideas on how to go about this? Thanks
I wouldn't recommend using Ctrl + z, because that is the undo method for
Office. Your users may not like that.
> I want to use a shortcut key (Ctrl+z) to activate a UserForm but don't know
> for sure it is possible or how to go about it. I've always used a Comm...Cell Content from UserForm Not Retained
I'm a novice user and I have a created a UserForm for placing certain
contents into particular cells. The problem is when I save and exit Excel
and come back into the same workbook, if I click that cell the UserForm pops
up as expected, but if I do not make a selection and close (click the close
button, red 'x') the userform or cancel the userform the cell contents from
the previous save disappear and the cell is blank. I would think the cell
contents should stay as is until I put some information into the cell.
Is there a way to keep the cell contents when I...VB Groups
From: "Stuart Grant" <sagranatbluewin.ch>
Subject: Re: "Unrecognized data base format"
Date: 18 September 2007 18:42
"Reset List". That's all it took. Thanks
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
>I see 36 groups starting microsoft.public.vb.
> I see you're using Outlook Express. Try selecting Tools | Newsgroups from
> the menu bar (or use Ctrl-W), then reset the list.
> Doug Steele, Microsoft Access ...