vba

Excel VBA combox box disable

Hi all, I am trying to enable/disable a combobox based on the value or state of a second combobox in Excel 2007. I think my code should look something like this: Sub DropDown266_Change() If DropDown266.Index = 2 Then DropDown267.Enabled = False End If End Sub However, I am getting a run time error '424' saying an ob...

Outlook 2007 Script that sends new form email when a message is dragged and dropped into a folder

Is it possible to write a script that will allow Outlook to automatically send out a new email to a distribution list when you drag and drop and previously opened email into a specified folder? The rules only let you apply them to received and sent messages. They do not allow you to apply it to anything that is dragged and dropped after...

Access ADP - For/Against?

I have been tasked with taking an Access 97 application and moving the back-end data to SQL Server while moving the front end to Access 2003 (using Access Data Projects). In the process of this migration the back-end data structures will be changed significantly to support new functionality. If I had my wish we would not be using Access...

How to generate XML from an Excel VBA macro?

So, I've got a bunch of content that was delivered to us in the form of Excel spreadsheets. I need to take that content and push it into another system. The other system takes its input from an XML file. I could do all of this by hand (and trust me, management has no problem making me do that!), but I'm hoping there's an easy way to writ...

In Microsoft Access 03. Creating 2 critera for one report

In Microsoft access 03.I am creating a database and want the user to have the option of two critera. Critera 1, the output on the report is filtered by accounts that have a varinace of >=10% or <=-10%. Or, Critera 2, allow the user to be able to input a specific variance on a form, that will only output on a report accounts that have tha...

Can I turn off inline syntax checking in the Office 2003 VBA editor?

As anybody who uses VBA in Office 2003 will know, it has the extremely frustrating tendency to do a syntax check every time you click off a line. For example, if I start writing a line of code, I might go For Each application In And then think "crap, what's the application collection called?" So I'll hit "page up" to find it, and get...

Pivotcache problem using ado recordset into excel

I'm having a problem with runtime error 1004 at the last line. I'm bringing in an access query into excel 2007. I know the recordset is ok as I can see the fields and data. Im not sure about the picotcache was created in the set ptCache line. I see the application, but the index is 0. Code is below... Private Sub cmdPivotTables_Cli...

Creating a POST body in VBA

Does anyone know how to construct a POST DATA body in VBA? I'm trying to upload rather lengthy strings via a post call using the "Microsoft.XMLHTTP" object. I'm not tied to using that object for making the HTTP request either. ...

Ensuring the contacts in a Distribution List are displayed with both name and email address

How can I ensure the contacts I add to an Outlook distribution list are displayed with both name and email address? These contacts may not exist in any other address book, just the distribution list. Currently they show up just as an email address (in both columns). Here's roughly the VBA we're using: Do Until RS.EOF //h...

VBA - Prevent Excel 2007 from showing a defined names message box?

I am working on a Excel 2007 workbook that will contain a macro to save the current sheet (a template) as a PDF file (no problem) a Excel 97-2003 file (problem) When saving the Excel file a messagebox appears asking about "Defined names of formulas in this workbook may display different values when they are recalculated...Do you wa...

Store #VALUE! #NUM! #REF! in variable.

So a simple version of what I'm trying to do. Say I know there is an error in cell(1,1), furthermore I know it is either #num!, #ref! or #value!, I want to be able to store the respective error message in a variable, so I can print it to a different sheet. This is what I tried and it clearly failed. Sub FindAndPrintErrors dim Store as...

Upload a file with POST (multipart/form-data) using VBA

Does anyone know if it's possible to upload a file via POST body (multipart/form-data) using VBA? I'm currently using the Microsoft.XMLHTTP object, but I'm not tied to it if that doesn't support multipart POST. Here's what I'm doing so far: Set oHttp = CreateObject("Microsoft.XMLHTTP") oHttp.Open "POST", theUrl, False oHttp.setRequest...

Rows and Column of Excel File

It is possible to write a code that specifying the rows and column of spread sheet in terms of NUMBERS and NOT LIKE (B2:D6) Example: excelSheet.Range("B2:D6").Interior.Color = RGB(100, 100, 255) instead of B2 and D6 I want to write 5 rows and 3 column.. It is posible to write in vb.net 2003 code? ...

Highest populated dimension of an array vba

Say i have an single dimension array (to keep it simple). Is there a simple way to tell what the highest index of an element that was explicitly assigned a value? other than to loop through and count? I know Ubound finds the highest dimension of the array but that's not what I need. Is there something like Ubound but it only counts popu...

vba function, return from function

I don't normally use VB, and even less vba for excel, but I'm writing a function inside a macro and seem to not understand even the basics of creating a function For example Public Function test() As Integer return 1 End Function This gives a compile error. This is profoundly stupid, but how do I make a function return an intege...

Is there a JSON parser for VB6 / VBA?

I'm trying to consume a web service in VB6. The service (which I control) currently can return a SOAP/XML message or JSON. I'm having a really difficult time figuring out if VB6's SOAP type (version 1) can handle a returned object (as opposed to simple types like string, int, etc.). So far I can't figure out what I need to do to get V...

Capture output value from a shell command in VBA ?

Found this function http://www.cpearson.com/excel/ShellAndWait.aspx But would need also to capture output from the shell output. Any code suggestion ? ...

VBA, inline array

Looking to create an inline array in Visual Basic for Applications Something like this would be cool Dim a() as Integer set a = {1,2,3} In Java, this would be the equivilant functionality int a[] = {1,2,3}; Also, bonus points if you can tell me how to find its length afterwards (without needing to hard code it, as all the example...

Isn't VBA Shell supposed to be asynchronous ?

When I call a rebol script with call shell("rebol.exe myscript.r") The shell doesn't return until the script is finished. Is there a way to force VBA Shell to be asynchronous ? ...

Create an automatic date stamp in excel from an entry.

I am trying to have a date stamp event happen in column B when an entry is made in column A. Now i can do this in VBA with no problem, the trouble i am running into is there is also a entry that will eventually go in say column D and would need a date stamp in column E as well. is this possible. here is a sample of the code i have used s...