Help on subscript out of range error (VB6/VBA)
I want to work with multiple excel workbooks en worksheets using a
stand alone VB6 application.
1. First I open and close the workbooks and populate a listbox with
2. Then I select some sheets and fill an Array. (This array contains
sheetnames from different workbooks)
3. The last step is to open and close the workbooks again and loop
(For Each) through the sheets to get the information I need using the
above mentioned array.
The only problem is that I receive an "Subscript out of Range" error.
This error occurs because I'm attempting tot access a workshee...Word 2003 VBA to limit options in Inputbox to those in drop down
I have the following macro which works great to make a form drop down list mandatory to fill in:
If ActiveDocument.FormFields("nameDD").Result = "ENTER NAME" Then
sInFld = InputBox("This field must be filled in, fill in below.")
Loop While sInFld = ""
ActiveDocument.FormFields("nameDD").Result = sInFld
However, the user is free to enter whatever they want in the input box, although the field this fires from if nothing is entered is a drop down- is there any way to ...VBA Function Reference
Is there a good VBA reference manual or website?
I have in mind something like the Principles of Operations manuals
(for you dinosaurs who remember Assembly Language) that shows each
function with the parameters and a few examples.
For which Office program and version? They vary depending on version,
and each program has it's own objects and methods.
On Mar 18, 10:31=A0am, Square Peg <Square...@Round.Hole> wrote:
> Is there a good VBA reference manual or website?
> I have in mind something like the Principles of Operations manuals
> (for you dinosaurs who remem...VBA Functions Excel 2002
I have created a Function (see below) but regardles of the numbers I enter,
I can only get one result to display. That result is Poor-Improving
Grrrr! What am I missing here? can anyone help-Please!!!
Function EvalAll(OverallEval As Double)
If RecentEvaluation >= OverallEvaluation And OverallEvaluation > 4 Then
EvalAll = "Good-Improving"
ElseIf RecentEvaluation >= OverallEvaluation And OverallEvaluation < 4 Then
EvalAll = "Poor-Improving"
ElseIf RecentEvaluation >= OverallEvaluation And OverallEvaluation > 4 Then
EvalAll = "Good-Impro...Find function in a macro
I want to set up a macro that searches a column for a value 'X' and then
selects the cell right under the cell that contains 'X'.
I have been stumped on this for a few days now and would really really
appreciate any sort of help or guidance.
Thanks a lot!
Message posted from http://www.ExcelForum.com/
Dim r as Range
For Each r in Range("A1:A1000") 'Or whatever yours is
If r.Value = "X" Then
Range("A" & r.Row+1).Select 'Change A to your column
P.S. You could probably use an...Quick Camaign (marketinglist)
If we create one quick campaign email action with a marketinglist over
visual studio it create automaticly threefold mail actions. And alsow the
mail activity is not send. If we create this by hand everything works fine.
We have install rollup 2.
Thanks fpr any help.
I have a form with a combobox control that list some sizes. They are:
I have another text box for keying a custom size, such as 12'2". What I
would like to do is have the combobox default to the next size (in this case
18). Here's the code I have used so far (it does a little more than what I
am asking for but to give an idea):
Dim MCUST As String
MCUST = Me.custwidth
If Str(Me.widthck) <> Me.custwidth Or Len(Me.custwidth) <> Len(Me.widthck)
Me.widthck.Value = Int(Val(MCUST)) + 1
If InStr(Int(Me.widthck) / 2, ".&...VBA code question?
I have this simple 3 subs vba code. It runs 8 times and each solution
has 24 values that is put in one column of 24 raws. So, the 1st
solution found gets written at N2 to N25....and so on.
The problem I have is this: The 1st solution that gets written from
N2-N25, later it gets removed; just the 1st solution! What could be
causing this in the code? Thanks in advance.
Option Base 1
Dim cell As Range, ModelCounter As Integer, JobNr As Integer
Dim ret As Integer
Dim ARngSolution As Range
Application.ScreenUpdating = False
ModelCou...top N values per group using VBA
I am trying to follow an example for finding top N values using VBA given at
this link: http://support.microsoft.com/kb/210039/en-us#appliesto
I've had success with this in the Northwind example database (with my own
tables or with Northwind tables) ...
But in my own databases (with my own tables) I get "Compile error:
User'defined type not defined" with ", db As Database" highlighted in the
code when I compile in the module
and "Compile error.in query expression
I am wondering if it's possible to have text font return to automati
(black) when someone enters their name in my password textbox an
Here's the layout. I have a userform set up ("Password") which runs o
workbook_open. When it comes up the person must enter their name i
Textbox1 and click OK in order to view the page. In rows D and E, th
text has been manually selected as white in order to hide the contents
Is there a way to set up a code in the Password userform so that:
Private Sub CommandButton1_Click()
If Textbox1.Text = "Mike" Then
Sheet1.Range(...Accessing named ranges in Excel from VBA
Can anyone tell me if and how I can access a named range on a workshee
in a VBA procedure?
The value of the cell is read from a record with vlookup, I need to b
able to access it in a procedure in VBA as input in a new record.
Basz's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1234
View this thread: http://www.excelforum.com/showthread.php?threadid=39458
You can get the Value property if it is a single cell, o...Can't pass string >255 characters to Word document with VBA
I'm reposting this to see if I can get some additional help as I've been
unsuccessful at resolving this problem.
I've created a form-based application using Access that helps users
automatically fill out a Word form. For the most part, everything is working
great EXCEPT when I try to pass any string greater 255 characters in length
from Access to a Word text field using VBA. If it's shorter than 255
characters, I never have a problem, and the string passes fine. But when
greater than that, the string simply doesn't pass.
At the suggestion o...adding VBA
I am REALLY new at access and found a great VBA code for cascading combo
boxes. The only problem is I do not know where / how to install this code.
Any suggestions would be VERY greatly appreciated.
Thank you in advance
Perhaps a sample would be useful. On my website is a small sample database
(http://www.rogersaccesslibrary.com/forum/topic389.html), which illustrates
several variations. At the very least, it will show you where to put the
code. Look in the Event properties of the combo boxes.
--Roger Ca...Drawing in VBA
I have “inherited” a number of legacy worksheets that use, I believe, the pre
Excel 97 via VBA drawing object model to plot complex diagrams on a number of
These work perfectly in all versions of Excel up and to Excel 2003, but now
give problems when running under Excel 2007 (although the VBA compiles OK) .
In Excel 2007 the positioning and rotation of the arcs (and to some extent
other drawing items).
are totally different in Xl 2007
A simply example of the code I have is show below:
With ActiveSheet.Arcs.Add(10, 10, 200, 200)
With...sendkeys action requires utility add in access 2003
I Know that this has been asked before. My question is why it will not pop
up on one computer but will on another. The same actions being performed.
Any input will be helpful.
"Craig" <Craig@discussions.microsoft.com> wrote in message
>I Know that this has been asked before. My question is why it will not
> up on one computer but will on another. The same actions being performed.
> Any input will be helpful.
> Thanks Craig
You'll have to give a few more details a...VBA-generated ScreenTip from an autoshape
I have an autoshape manually attached to a sheet. I want that it can
detect whenever the mouse pointer hovers over it, say for example,
showing a comment like a toolbar ScreenTip. Any help would be much
Osong's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=25394
View this thread: http://www.excelforum.com/showthread.php?threadid=389054
...Calling GP existing report from vba code
Can anyone show me that how to call the GP reports from VBA code.
Is this the correct newsgroup to post Great Plains Report Writer VBA
Customizations questions? Don't see any other GP newsgroups.
yes - go ahead and post
"Chris Patten" <ChrisPatten@discussions.microsoft.com> wrote in message
> Is this the correct newsgroup to post Great Plains Report Writer VBA
> Customizations questions? Don't see any other GP newsgroups.
...Linking .JPG files using VBA
I have a Table that includes the field "FileLocation" which contains the full
file name of various JPG files.
I wish to preview those files on an Access Form but I do not wish to
manually insert the protographs one-by-one: rather I wish the photo to be
displayed or, create an additional OLE Object field in the Table and, using
VBA, populate that field with the required linkages.
What version of Access is this?
In Access 2007, you can bind an image control to a field. Dead simple. Even
works even on continuous view forms.
In older versions, use the Current event of the form t...To Generate 500 almost identical VBA Lines?
I have to create 500 lines of almost identical VBA code. Code is
and so on untill
Range("y500").GoalSeek Goal:=ActiveSheet.Range("z500").Valu...A few VBA questions
I'm currently trying to teach myself VBA. I may have set myself a rather
ambitious problem, and I'm wondering if anyone can help. There are a few
queries. All the queries center around the same report that is generated by
another program - the locations of headers can change column each time the
report is generated, and the number of rows change each time.
A simplistic view of the report is as follows:
A B C
1.Origin Destination %Margin
2. ABC DEF 5
3. GHI JKL 10
4...Adding a button to the Actions menu for Outlook 2003 for Contacts
I am working on an add-in for Outlook 2003. I am using VSTO and
Visual Studio 2008. I have successfully added buttons to the "Tools" pulldown
and the "Actions" pull down for viewing mail. When the user switches to
looking at contacts the contents of the "Actions" pull down changes. I want
to add a button to this actions pull down, not the one displayed when viewing
I have been unable to find the series of calls to give me access to this
menu. The ones which work hagve gone through
I h...merging ranges in VBA
i am running this code,
Set SourceWB = Workbooks("book1.xls")
' alot of other coding, but this seems to be the problem area
Set SourceWB = Workbooks("book1.xls")
.Range("K7").Value = FormatPercent(.Range(&q...Linking formulas to text boxes in VBA
I just posted this to the programmers section, but I think those folks
are into more serious things than this! I'm newly experimenting with
VBA, so apologies if this is a stupid question. Any help much
I have a For - Next loop that creates a formula linking a cell in an
'input sheet' ("Key") to a cell in any one of 200 sheets. For cells,
this is no problem, using:
For i = 1 to 200
Worksheets(i).Range("c2").Formula = "=Key!B" & i
My problem comes when I try to do the same with some text boxes that
are in each of the 200 s...UserForm loaded twice in VBA Project Explorer
For some reason my userform is loading twice in Project Explorer.
I believe it is causing an out of memory error when I attempt to add/edit
code on the userform.
Does anyone know why it does this and how I can make it stop?
Thank you for your assistance
Just right click on the userform name of the dupicated userform you want to
remove and click remove.
If this helps, let me know by clicking "YES" below.
> For some reason my userform is loading twice in Project Explorer.
> I beli...