vba

How to fall through a Select Case in Excel VBA?

Given Select Case cmd case "ONE": MsgBox "one" case "TWO": MsgBox "two" case "THREE": MsgBox "three" End select My requirement is if cmd = "ONE" I need "one" and then "two" displayed however currently I am getting "one" displayed and then the program is breaking out of the select case... ...

Converting C# console app to VB.NET and VBA

I have to convert a C# project to VB.NET and VBA. It's a console app that uses the Microsoft Office API (Microsoft.Office.Interop.*). My two questions: C# -> VB.NET: .NET Reflector is a good tool for this, except that it doesn't preserve source code comments. Is there a way to do this? .NET -> VBA: is there an automated tool to do thi...

Events not working in MS-Access

The database that I am working on (in MS-Access XP) seems to have become corrupted somehow. It no longer supports any events - clicks, change, update events, nothing seems to work. This is the error that I get: What can I do to make events start working again? I have tried Tools->Database Utilities->Compact and Repair Database..., bu...

VBA Word 2003 Dialog box

Hi, Our client enironment recently migrated from word 2000 to 2003, we use the below code in one of the templates to show the word's default insert file dialog box. Word is integrated with another third party application Hummingbird docspen. With Dialogs(wdDialogInsertFile) .Name = "q:*.*" .Show End With In old environment ...

Excel - allow copy/paste but no data entry

Hello, I have an Excel sheet which is protected and a few contiguous cells which are editable. Is there a way I can allow a user to copy paste data into these cells, but the user should not be able to type in values directly into these cells? I am willing to accept a solution using VBA too. Thanks in advance. Regards, Anindya ...

Access 2007 Recordset problem.

I am trying to migrate Access 2003 (running fine) to Access 2007. The code written in VBA creates some issues. Like I have one main form and 2 subform. In main form recordsource set set by a Dynamic query but based on main form data when I am trying to set the Recordset of subform then access 2007 crash & close itself. Could you please ...

sql Query in VBA code

If I want to code the following in VBA how do I do it QUERY1: SELECT field1, Min(field4) AS MinField4, Max(field5) AS MaxField5 FROM Table1 GROUP BY field1; SELECT Query1.field1, Table1.field2, Table1.field3, Query1.MinField4, Query1.MaxField5 FROM Query1 INNER JOIN Table1 ON (Query1.field1 = Table1.field1) AND (Query1...

Timer on user form in Excel VBA

I've got some old Excel VBA code where I want to run a task at regular intervals. If I were using VB6, I would have used a timer control. I found the Application.OnTime() method, and it works well for code that's running in an Excel worksheet, but I can't make it work in a user form. The method never gets called. How can I make Applica...

How to detect Theme fonts in Powerpoint 2007 VBA?

Does anyone know how to detect the use of Theme fonts in Powerpoint 2007 slide objects using VBA? If one looks at Shape.TextFrame.TextRange.Font.Name the font name appears as simple name (ex: "Arial") whether or not the font was assigned as a fixed name or a Theme name (subject to change with the document theme). I don't see any other...

Is it possible to run a VBA function whenever Outlook starts up?

I would like to have a VBA function run as soon as Outlook starts up. Is this possible and if so, what do I need to do? My searches on Google have failed me. I don't mind that the security alert will pop up. ...

Updating Word Template with bookmarks

Hi. I have Template made in Word 2003 which is sometimes updated (adding text, bookmarks, formfields ...) and its located on intranet and has the same name all the time (for example "Master_layout.dot"). When somebody create the document from this template (for example version 3) and then I will make version 4 then the document made from...

Syntax (probably BNF) spec of VBA ?

Hi, I have to maintain a portion of Access 2003 VBA code, which is not my primary programming language, and while I'm pretty solid on doing regular stuff, I would still like to have a pure spec of the language syntax.. It just saves a lot of time compared to reading tons of stupid tutorials that tell me what a for loop is. Is there any...

How do I escape all special characters in Access Jet SQL?

I'm trying to change a password with a DDL statement like: CurrentProject.Connection.Execute "ALTER USER barney PASSWORD "[]!@#$%^ oldpassword" Yes, that's a nasty password, but someone tried something like that. Notice the beginning quote of the password is not part of the sql syntax here. I need something like mysql_real_escape_st...

Integration with Office 2007 VBA and Visual SourceSafe

I'm wondering if there's a way to manage VBA code authored in Excel 2007 using Visual SourceSafe? Office XP and 2000 apparently had 'developer additions' that supported this (e.g. http://msdn.microsoft.com/en-us/library/aa164419%28office.10%29.aspx). Is this support missing in Office 2007? ...

Excel VBA - connect to sql with a trusted connection (no uid/pwd)

Is there a way to have Excel connect to Sql Server using the current user's network windows authentication (trusted connection/integrated security)? I don't want to rely on a sql login or have a uid/password in my code. ...

Can this be done using excel macos?

Hi Guys, I am new here and have been refered to this site by someone who thinks its the best site for programmers. I also think it is!! I am new to Vb and excel Macros. I want to do the following things with a 13 column and 1000 rows spreadsheet. Determine the Unique items on Column A to J Move the Unique items to a new Sheet Transp...

VBA: Querying Access with Excel. Why so slow?

I found this code online to query Access and input the data into excel (2003), but it is much slower than it should be: Sub DataPull(SQLQuery, CellPaste) Dim Con As New ADODB.Connection Dim RST As New ADODB.Recordset Dim DBlocation As String, DBName As String Dim ContractingQuery As String If SQLQuery = "" Then Else DBName = Range...

How do I get the current logged in Active Directory username from VBA?

I am new to Active Directory. I have a VBA Excel Add-In that should run if, and only if, the computer that it is running on is currently logged into the Active Directory, whether locally or through a VPN. Knowing the domain name, how would I retrieve the user name for the currently logged in user? Thanks! ...

Methods in EXCEL Addin - XLL

Hi, How do I know which methods are available in my XLL module, in case i need to use / call any of them in my VBA code. I can do this by calling the: Application.Run() method, in which I have to pass my macro-name as the parameter. My question is about this macro-name: how do I know which macros are present in my XLL addin. Any h...

Combine several RTF texts into one RTF file using VBA

I'm extracting 'task notes' from MS Project using VBA and want to create a MS Word .DOC file and also copy those texts into EXCEL. If you use the Notes property of the Task objects you only get 255 characters and formatting will not not be retained. In order to keep formatting you can convert the .MPP file into .MPD and extract the note...