vba

Manipulating excel "autoshapes" with VBA

I am trying to write a macro in VBA (Excel) that is assigned to a Checkbox. Whenever the checkbox is clicked, an "autoshape" will change its "order" from "Send to Back" to "Send to Front". Basically, I am trying to create a dashboard with multiple panels, so that users can access information without moving between sheets. Each panel wi...

MS Access Force report footer to bottom of page

I am trying to make a report for a proposal. I would like to keep a professional look and always force the terms section to the bottom of the page. I could use the page footer but I only want the terms to show on the last page. My idea is somehow with VBA to set the height of a dummy group such that it forces the report footer to the bo...

In Word, Programmatically Open New Document Dialog

I am looking for a way to programatically open the "New Document" dialog in Word 2007. It is the same one you get when you select File->New . You can also open it using the FileNew macro or the "New..." menu command. However, I have been unable to find a way to do this programmatically. I have tried: Application.Run MacroName:="Fil...

Stop VBA Evaluate from calling target function twice

I am having trouble getting VBA's Evaluate() function to only execute once; it seems to always run twice. For instance, consider the trivial example below. If we run the RunEval() subroutine, it will call the EvalTest() function twice. This can be seen by the two different random numbers that get printed in the immediate window. The beha...

Naming convention for VBA modules?

I never really know how to name VBA modules. Should I: Use a prefix, like basName or modName. Not use a prefix, like Module. (But avoid restricted words) Something else ...

Excel VBA: how to insert a new row into a range and copy formulas

Hi There I have a named range like the following covering A2:D3 ITEM PRICE QTY SUBTOTAL 1 10 3 30 1 5 2 10 TOTAL: 40 I am looking for some VBA code to insert a new row into the range copying the formulas not values. Any tips/links greatly appreciated. ...

Problem with passing parameters to SQL procedure using VBA

Hi, I am trying to pass @intDocumentNo and @intCustomerNo to a stored procedure using VBA but only @intCustomerNo is updated in dbo.tblOrderHead. I don't think the problem is with the procedure because if I enter the values manually it runs properly. What am I doing wrong? VBA Code: Private Sub intCustomerNo_Click() Dim cmdCommand A...

Count number of arguments to Excel formula in VBA

I need to use VBA to determine the number of arguments passed to an Excel formula. For instance, suppose a cell contains the formula =MyFunc($A$1, "xyz", SUM(1,2,COUNT(C1:C12)), IF(B1>2,1,0)). Then the counter function should return 4. Does VBA contain any built-in functions for this, or does someone have an example of a regular expressi...

VBA Public Function to Excel

Dear sir , I have create below function Option Explicit Public Function fyi(x As Double, f As String) As String Application.Volatile Dim data As Double Dim post(5) post(1) = "Ribu " post(2) = "Juta " post(3) = "Milyar " post(4) = "Trilyun " post(5) = "Ribu Trilyun " Dim part As String Dim text As String Dim cond A...

Exposing .NET enums to COM clients{VBScript}

Am trying create of PoC for exposing/invoking various .NET objects from COM clients. The .NET library contains some classes and Enums. Am able to successfully access the classes in VBScript but not able to access the Enums. I know that Enums are value types and hence 'CreateObject' wont work in this case. But am able to access the sam...

Formula to follow addition of rows

New to VBA, please help. My apologies. I have not done a good job of making myself clear. Let me try one more time. My sales reps enter every call into a call sheet. They call on 50-60 people a week; some they will see more than once a week, some only a couple of times a year. On this call sheet are 4 columns; date of call, custom...

Excel / VB - How do I loop through each row/column and do formatting based on the value?

Here's what I need to do: 1) Loop through every cell in a worksheet 2) Make formatting changes (bold, etc) to fields relative to each field based on the value What I mean is that if a field has a value of "foo", I want to make the field that is (-1, -3) from it bold, etc. I tried to do this with the following script with no luck. Than...

Ms Access Save record in subform

I have a main form with a tab control containing multiple subforms. I need to be sure that the data in a subform is saved when the user switches tabs. The problem is that DoCmd.RunCommand acCmdSaveRecord seems only applies to the current form so it doesn't save the data in the subform. I have tried different events on the subform such a...

Excel Macro to copy an entire row from one sheet to another based upon a single word, within a paragraph, inside a cell

Guys i'm looking for a simple excel macro that can copy a row from one sheet to another within excel based upon having a specific word in the cell. I have a sheet one, called "data" and a sheet two called "final". Here is an eaxmple of the data A B C D john mary 555.555.4939 initial rep...

VBA check if object is set

I have a global variable that is an instance of my custom class. How to I check if the object is set or if I need to initialize it? Thanks, Jeff ...

how to run .jar file in micro?

I have a .jar file to convert Excel into XML format. I want to have a button on the spreadsheet, when user click it, it will call. jar to convert the spreasheet. tried to use: Shell ("C:\Program Files\Java\jre6\bin\java -jar XMLGenerator.jar") it is not working, does anyone know how to do this? thanks. ...

Excel VBA: importing CSV with dates as dd/mm/yyyy

ello I understand this is a fairly common problem, but I'm yet to find a reliable solution. I have data in a csv file with the first column formatted dd/mm/yyyy. When I open it with Workbooks.OpenText it defaults to mm/dd/yyyy until it figures out that what it thinks is the month exceeds 12, then reverts to dd/mm/yyyy. This is my test...

UTC DateTime to Unix timestamp

How can I convert UTC date time to seconds since Epoch using MS VBA lanugage? ...

Excel VBA Userform Combobox problem

I'm having difficulties with a Combobox in a userform in an Excel document. The combobox either doesn't appear in the userform, or the combobox remains blank, and when I enter any character in it, the list of items appears, but 2 or 3 times, instead of just once. When I select an item, the chosen item doesn't appear in the box. It seem...

Minimize the Office Ribbon with VBA?

I haven't searched real hard recently but in the past I have searched high and low to figure out a way to minimize the ribbon with VBA code. For me, most of my users have no use for the ribbon in Access, I would be very happy if I could reclaim the screen real estate for them. I know I could train them to minimize it but...well...they a...