vba

In VBA, how can one use the Tools --> Office Links --> Analyze it with Microsoft Office Excel

I am attempting to export a query from MS Access into MS Excel in a way that does not carry over the Sorting and Grouping. I have noticed this functionality is simply available by opening a query and clicking: Tools --> Office Links --> Analyze it with Microsoft Office Excel However, I don't know how to get to this feature of MS ...

How to set focus on any object in MS Access using VBA

How can someone set the focus of an opened Query object within MS Access using VBA? I am doing something like this... If Application.CurrentData.AllQueries(myqueryname).IsLoaded = True Then 'set the focus ' Export to office links for analysis CommandBars("Menu Bar").Controls("Tools").Controls("Office Links").Control...

excel macro to change unformatted text data to correctly-typed data

I'm populating an excel sheet from DTS, but the resulting output is formatted as text since DTS sees the cells as varchar(255). I'm planning on adding a macro that will format the values correctly as numeric or datetime. What VBA would I use for this? eg the value in a cell shows as "2009-01-01 00:00:00". If I press F2 to edit the cell,...

Multiple Update Queries in Access

Using Access 2007, I have an update that I am trying to build a script or macro or even just a useful chunk of SQL that I can keep and use whenever I want to run the update... ...I have figured out how to this with an update query, but, I don't want to have to spend an hour or so everytime I want to update... Basically, I am cross walk...

Word 2007 VBA cannot control Pictures?

Try recording a macro in Word 2007, notice you can't do a thing to pictures. (Or is this a local issue with my machine?) And I can't even find the Picture / Image object within the Word Object Ref. What gives? ...

Is there any more documentation on WordBasic's FilePrintSetup?

I found the WordBasic.FilePrintSetup function when I was searching for a way to change Word's printer without changing Windows' default printer. Unfortunately I could not find any real documentation on FilePrintSetup, even the parameters I found with Google aren't officially documented. (Printer and DoNotSetAsSysDefault) So do you kno...

How to add headers to a multicolumn listbox in an Excel userform using VBA

Is it possible to set up the headers in a multicolumn listbox without using a worksheet range as the source. The following uses an array of variants which is assigned to the list property of the listbox, the headers appear blank. Sub testMultiColumnLb() ReDim arr(1 To 3, 1 To 2) arr(1, 1) = "1" arr(1, 2) = "One" arr(2,...

Making row ranges adjust

In my Excel spreadsheet, I've got a cell that is =SUM(C6:C19). If I go to C20 and add a row, that formula will not adjust. I want it to change to =SUM(C6:C20) ...

Recommended way to read and write .ini files in VBA

Are any methods available in VBA to read and write INI files? I know I could use; Open "C:\test.ini" For Input As #1 ...and parse the data. Instead I am trying to see what tools are already available. I know in C# you can do... using INI; INIFile ini = new INIFile("C:\test.ini"); Is there an equivalent for VBA? I am attempting ...

how can I read a binary file using VBA?

I have a binary file that resulted from a program written in Compaq Visual Fortran. How can I read specific lines and save them in an Excel sheet? ...

Can I create an undo transaction in Word or Excel? (VSTO)

I notice that Project 2007 has the functions that allow operations that can be undone to be placed in a single stack item, or "undo transaction". For example: Application.OpenUndoTransaction "Create 6 tasks" Dim i As Integer For i = 1 To 6 ActiveProject.Tasks.Add "UndoMe " & i Next Application.CloseUndoTransaction What this means ...

Version control for VBA file

I have a huge MS Access document with built-in VBA codebase. Is it possible to track the file (as I am developing it) with a (mercurial) version control system? Can I extract code and track that? Or is it just the-binary-file-path? Thanks. ...

Hex ANDing in Excel and/or Visual Basic

I'm trying to AND two hex number bit-wise in Excel/Visual Basic. Ex. 53FDBC AND 00FFFF which should yield 00FDBC. Any ideas on how to do this? ...

Performance benefit of variable declerations in VBA?

Is there a performance benefit of having variables dimensioned in the beginning of a function verses having them declared just before they are used? I am using VBA in MS Access 2003. Example, Function f(y As Long) As Long Dim x As Long If y <> 0 Then x = 1000000 End If End Function Verses Function f(...

How can you check for null in a VBA DAO record set?

I have an optional field in a database that I'm pulling out using a DAO Record Set. I need to check whether or not the field is set before I concatenate it with other fields. So far I have the following code snippet which I've tried with both Is and = (that's the obviously wrong syntax [[Is | =]]) to no avail. It appears that if I use...

How to obtain the macros defined in an Excel workbook

Is there any way, in either VBA or C# code, to get a list of the existing macros defined in a workbook? Ideally, this list would have a method definition signatures, but just getting a list of the available macros would be great. Is this possible? ...

Outlook automatically change reminder based on category

I need to automate Outlook so that when a user sets a certain category on an appointment, it automatically sets the reminder time based on the category. For example, the user has an "On site meeting" category and an "Off site meeting" category. He wants the reminder time to automatically change to 15 minutes for an on site meeting and ...

Disabling msgbox in access

I am trying to make a small form in MS Access 2003 SP3, I use some function that some other people made and these function has msgbox in it. I would like to disable msgbox while I am running the form. Is it possible in Access to disable msgbox? ...

Outlook VBA - How to access the range of time currently selected on a calendar?

I am trying to write a VBA macro in Outlook that will allow me to display a custom UI for entering information on Outlook appointments. I have this working for existing appointments, but I would like to be able to create new appointments by having the user click and drag to select a time range and then trigger the macro. (This works for...

How to highlight calculated fields in an Excel spreadsheet?

Is there a simple way to do this, via macro or otherwise? By calculated field I mean a field that is computed from other fields, versus raw entered values. By highlight I mean colored differently. I need this to better understand a large spreadsheet from a client. ...