vba

SQLite UDF - VBA Callback

Has anybody attempted to pass a VBA (or VB6) function (via AddressOf ?) to the SQLite create a UDF function (http://www.sqlite.org/c3ref/create_function.html). How would the resulting callback arguments be handled by VBA? The function to be called would have the following signature... void (*xFunc)(sqlite3_context*,int,sqlite3_value...

How do you prevent printing dialog when using Excel PrintOut method

When I use the PrintOut method to print a Worksheet object to a printer, the "Printing" dialog (showing filename, destination printer, pages printed and a Cancel button) is displayed even though I have set DisplayAlerts = False. The code below works in an Excel macro but the same thing happens if I use this code in a VB or VB.Net applic...

Deleting a file in VBA

Using VBA, how can I (a) test whether a file exists, and if so, (b) delete it? ...

MS Access - Controlling another database in VBA

I have the following code: Dim obj As New Access.Application obj.OpenCurrentDatabase (CurrentProject.Path & "\Working.mdb") obj.Run "Routine" obj.CloseCurrentDatabase Set obj = Nothing The problem I'm experimenting is a pop-up that tells me Access can't set the focus on the other database. As you can see from the code, I want to run a...

How can I refresh all the pivot tables in my excel workbook with a macro?

I have a workbook with 20 different pivot tables. Is there any easy way to find all the pivot tables and refresh them in VB? ...

How can I find last row that contains data in the excel sheet with a macro?

How can I find the last row that contains data in a specific column and on a specific sheet? ...

How would you create a database in microsoft access that is searchable only by certain fields?

How would you create a database in Microsoft Access that is searchable only by certain fields and controlled by only a few (necessary) text boxes and check boxes on a form so it is easy to use - no difficult queries? Example: You have several text boxes and several corresponding check boxes on a form, and when the check box next to the...

How to iterate through all the cells in Excel VBA or VSTO 2005

I need to simply go through all the cells in a Excel Spreadsheet and check the values in the cells. The cells may contain text, numbers or be blank. I am not very familiar / comfortable working with the concept of 'Range'. Therefore, any sample codes would be greatly appreciated. (I did try to google it, but the code snippets I found...

MS Word: How do I create a shortcut or toolbar button for the "Paste Special..Unformatted Text" option?

I have been playing with this for a while, but the closest I have gotten is a button that opens the "Paste Special" dialog box and requires another couple of mouse clicks to paste the contents of the clipboard as unformatted text. So often I am doing a copy-paste from a web site into a document where I don't want the additional baggage...

What are the implications of running a Microsoft access database in both 2003 and 2007?

What are the implications of running a Microsoft Access Database in both 2003 and 2007? Is there some class I forgot to take? The program was originally built in office 2003, and then run in 2007. Issues seem to happen when the machine it is being run on has both 2003 and 2007 on it. The issue would also appear to stem from reference ...

VBA resource for Python programmer

I've written a lot of code in Python, and I'm very used to the syntax, object structure, and so forth of Python because of it. What's the best online guide or resource site to give me the basics, as well as lookup equivalent functions/features in VBA versus Python. For example, I'm having trouble equating a simple List in Python with s...

How to iterate over all the page breaks in an Excel 2003 worksheet via COM

I've been trying to retrieve the locations of all the page breaks on a given Excel 2003 worksheet over COM. Here's an example of the kind of thing I'm trying to do: Excel::HPageBreaksPtr pHPageBreaks = pSheet->GetHPageBreaks(); long count = pHPageBreaks->Count; for (long i=0; i < count; ++i) { Excel::HPageBreakPtr pHPageBreak = pHPag...

How to programmatically make a Query in MS Access default to landscape when printed

How can I programmatically make a query in MS Access default to landscape when printed, specifically when viewing it as a PivotChart? I'm currently attempting this in MS Access 2003, but would like to see a solution for any version. ...

MS Outlook VBA - When is a MailItem not a MailItem?

I have written a message handler function in Outlook's Visual Basic (we're using Outlook 2003 and Exchange Server) to help me sort out incoming email. It is working for me, except sometimes the rule fails and Outlook deactivates it. Then I turn the rule back on and manually run it on my Inbox to catch up. The rule spontaneously fails and...

Excel Macro Help

I'm looking for assistance in creating an excel macro with the following two functions: Increment or decrement a value based on an action of another field. For example. cell b2 starts out with "0", it will either increment or decrement by "1" if another cell is clicked. Another way is say I have in cell D2, a two way arrow and one end ...

Iterate over and check the byte value of every character in a string - VBA

Iterate over and check the byte value of every character in a string - VBA Code I have: cell_val = CStr(Nz(fld.value, "")) Dim iter As Long For iter = 0 To Len(cell_val) - 1 Step 1 If Asc(Mid(cell_val, iter, 1)) > 127 Then addlog "Export contains ascii character > 127" End If ...

Executing stored procedures with date parameters: Command Object vs Connection Object

When supplying dates to a stored procedure via a parameter I'm a little confused over which format to use for the dates. My original VBA syntax used the ADO Connection object to execute the stored procedure: Set SentDetailRS = Me.ADOConnectionToIntegrity.Execute("dbo.s_SelectAggregatedSentDetailList '" & fCSQLDate(EffectiveDate) & "'", ...

Sending Excel to user through ASP.NET

I have a web application that is able to open an excel template, push data into a worksheet and send the file to a user. When the file is opened a VBA Macro will refresh a pivot table based on the data that was pushed into the template. The user receives the standard File Open / Save dialog. In Internet Explorer (version 6), if the u...

How can I use classes from VisualBasic-Express in VBA for Excel or Access projects?

I saved my VB-Express code as .dll and registered it with regasm and made a .tlb file. But when I try to run a function from it in an Excel-modul I get: Run-time error ‘453’: Can’t find DLL entry point RegisterServiceProcess in kernel32 What step did I miss? ...

Change .xla File with MSBuild

I'm trying to create a build script for my current project, which includes an Excel Add-in. The Add-in contains a VBProject with a file modGlobal with a variable version_Number. This number needs to be changed for every build. The exact steps: Open XLA document with Excel. Switch to VBEditor mode. (Alt+F11) Open VBProject, entering...