vba

Does anyone have a good example of controlling multiple Excel instances from a .Net app?

We have an Excel 2002/XP based application that interacts with SQL 2000/5 to process fairly complex actuarial calculations. The application performs its function well, but it's difficult to manage. We're trying to create a "controller" application or service that can manage and monitor these various instances of Excel (start/stop/proces...

Win32 ShellExecute and a UNC Path

I'm writing a little macro which will fire up a flash presentation. I'm using VBA to do this inside Powerpoint 2007. I am calling the Win32 ShellExecute() routine. Everything works GREAT but when I run this from a location whose path is a UNC path (\myserver\myfolder\sample.ppt) it does not work. The ShellExecute routine expects 6 argum...

Date manipulation in VBA

Is it possible to manipulate the components (year, month, day) of a date in VBA? I'd like a function that, given a day, a month, and a year, returns the corresponding date. ...

Excel Macro Language

I have an old Excel 4 Macro that I use to run monthly invoices. It is about 3000 lines and has many Excel 5 Dialog Box sheets (for dialog boxes). I would like to know what the easiest way would be to change it into Visual Basic and if it is worth it. I would also like to know how, if once I have converted it to VBA, how to create a st...

Best solution for using EJBs from Excel

We would like to give access to some of our EJBs from Excel. The goal is to give an API usable from VBA. Our EJBs are mostly Stateless Session Beans that do simple CRUD operations with POJOs. Some possible solutions: Exposing the EJBs as WebServices and create a VB/C# dll wrapping them, Using Corba to access the EJBs from C#, Creati...

Combine rows in Access 2007

I'm looking for an Access 2007 equivalent to SQL Server's COALESCE function. In SQL Server you could do something like: ---Person--- John Steve Richard DECLARE @PersonList nvarchar(1024) SELECT @PersonList = COALESCE(@PersonList + ',','') + Person FROM PersonTable PRINT @PersonList Which produces: John, Steve, Richard I want to d...

Append Subject Header in Outlook (VBA)

Basically, we have a rule setup to run a script when a code word is detected in the body of an incoming message. The script will append the current subject header with a word in front. For example, Before: "Test Message", After: "Dept - Test Message". Any ideas? ...

How to move mails from one linked Exchange mailbox to another in MS Access

I have an Exchange mailbox linked as a table in an MS Access app. This is primarily used for reading, but I would also like to be able to "move" messages to another folder. Unfortunately this is not as simple as writing in a second linked mailbox, because apparently I can not edit some fields. Some critical fields like the To: field ...

Programmatically exclude page items in olap pivot

I have a pivot table on an olap cube. I can go into a page field and manually deselect multiple items. How can I do this in VBA based on a list of items I need excluded? (n.b. I do not have a corrresponding list of items I need included) I know how to exclude these items in other ways, by altering the underlying query for example. I spe...

Problem with MS Access, the clipboard and something called Biff5!

Hi, I have a legacy app I am currently supporting that is having problems when people copy large quantities of data from a datasheet view. The App is built in MS Access and the amount of rows being copied can get pretty large (sometimes in the thousands). The funny thing about it is, you can paste the data out, but then Access keep...

Most efficient way to see if an item is or is not in a listbox control

This request is based in MS Access VBA. I would like to know what the most efficient way is, to see if an item exists in a listbox control. ...

All possible uses for the Application.SysCmd Method

Is there a place to find all possible uses of the syscmd method in MS Access? I know Microsoft has a developer reference, but I have found there are many other uses for this method that are not listed here. ...

how do i determine the number of rows in a range in excel using VBA

in my code i know the range name of the start of a list - 1 column wide x rows deep how do i calculate x? there is more data in the column than just this list, however this list is contiguous - there is nothing in any of the cells above or below or either side beside it ...

Use VBA in Office 2007 Applications?

Is VBA going to go away any time soon, like VB6 has? Should I not develop new Office applications with VBA? Or should I be developing all new Office Apps with VSTO? Update: Recently read this article. ...

When to use a Class in VBA?

When is it appropriate to use a class in Visual Basic for Applications (VBA)? I'm assuming the accelerated development and reduction of introducing bugs is a common benefit for most languages that support OOP. But with VBA, is there a specific criterion? ...

How to work around the [1] IE bug while saving an excel file from a Web server ?

I've noticed that Internet Explorer adds a number in square brackets to files downloaded from the internet (usually [1]). This creates a big problem with downloading Excel spreadsheets as square brackets are not a valid filename character inside Excel worksheet name. That problem is IE specific, others browsers are keeping same file name...

How to tell if an Excel Workbook is protected

I can use properties of an Excel Worksheet to tell if the worksheet is protected (Worksheet.Protection, Worksheet.ProtectContents etc). How can I tell using VBA if the entire workbook has been protected? ...

MSExcel 2002 calling Web Services.

What is the easiest way to call a web service from Excel (I am using version 2002)? Please, no third party tools or libraries. This has to be easy with some VBA that I can paste there, use it, and ever touch. ...

What causes "Invalid advise flags" run-time error in Excel VBA?

I have a Excel macro that generates a this error whenever it gets input of a specific format. Does anyone knows in general what an advise flag is OR where can I find information on this type of error? Thanks Runtime error -2147221503 (80040001): Automation error, Invalid advise flags ...

How to protect cells in Excel but allow these to be modified by VBA script

I am using Excel where certain fields are allowed for user input and other cells are to be protected. I have used Tools Protect sheet, however after doing this I am not able to change the values in the VBA script. I need to restrict the sheet to stop user input, at the same time allow the VBA code to change the cell values based on certa...