vba

ms-access: using getrows method

i am new to access and i am debugging someone's database how do i know if i am using ADO? i have stuff in a listbox, how do i use the .GetRows method to put the recordset into a two-dimensional array? ...

save all email attachments in outlook folder to folder

Hi, I have about 80 emails, all with attachments which I would like to save to a folder on my hard drive. Rather than open each message and go to save attachments, I'm looking for a script that can do this? Anyone know of how this can be done? Thanks, ...

How to kill the focus of Microsoft Word™ document window?

Hi, I'm developing a Word addin in Delphi, on a task pane I put a Virtual treeview, in the OnFocus event of the Virtual Treeview I call Word to insert a file into the current Word document via method ActiveDocument.Range.InsertFile, but this operation will put the input focus back to the Word document window, so finally in this event h...

Multiple Queries in One Report - MS Access

To keep this simple, lets say I have two tables. The first is called Employees. It contains an id field and an employee_name field. The second is called Pay. It contains an id field, an employee_id field and an amount field. Now, I want to run a report on Pay that shows me how much each employee got paid by showing me only the Emplo...

VBA disable/enable shortcut key combinations

I need to enable and disable shortcut key for select all "Ctrl + A". FindKey(BuildKeyCode(wdKeyControl, wdKeyA)).Disable FindKey(BuildKeyCode(wdKeyControl, wdKeyA)).Rebind wdKeyCategoryCommand, ?? What is the command parameter for Ctrl + A?? I cannot find this information anywhere! Also I want to apply it only for my templates: Cus...

Call Excel COM Addins functions using macro

How can I call a function defined in a COM Addin using excel macro ? Basically I have created a Excel COM Addin which does some bunch of stuff. Now I want to invoke this via excel macros. Is it possible to do it ? Or Is it possible to install COM Addin using a macro ? ...

Closing C# object through excel code

I have created a C# library's COM object in VBA code (Excel). This C# library logs all messages in the log file. I have written some code in finally method and wish to invoke it each time I close the object through excel. But whenever I close the object through excel it does not call the code available in finally method. Please suggest h...

MM-DD-YYYY to day of week, analyzing consecutive working days

I'm analyzing data based on x consecutive working days, M-F (and later skipping selected holidays). My plan is to take MM-DD-YYYY and determine the day of the week. How can I do this in VBA? I found this simple way using .NET but how do I call from Office 2007 VBA, and what reference do I need to add? DateTime.Parse("2009-10-02"...

Excel VBA, how to do multiple database entries

I need to populate a database with thousands of entries on a daily basis, but my code at the moment manually inserts each one into the database one at a time. Do While lngSQLLoop < lngCurrentRecord lngSQLLoop = lngSQLLoop + 1 sql = "INSERT INTO db (key1, key2) VALUES ('value1', 'value2');" result = bInsertIntoDatabase(sql, T...

How do I get my macro to stop if i cancel save a copy

Greetings one and all - a christmas puzzle for anyone still looking at this site...This works but if i decide to cancel the process (ie not save a file and stop the process at this stage) it doesn't svae the file but the following marco (filltolastrow2) is still activated how can I stop this happening? Public Sub SaveaCopyIncomeSheet() ...

SQL Server 2005 DBA Learning Resource

So I have some experience with Microsoft Access, building database apps for people, vba, etc for different folks at work....different divisions. And I have actually learned a lot in that realm...however, now the need for SQL Server has arrived, and I have never really ventured into that realm...so let the questions begin: how vastly di...

How to go to tab-number 1 when tab-end instead of going to next post?

I have a form in MS Access 2007. To change from one inputfield to another the user can use tab or enter. The problem is when the user is in the last field and hit tab or enter she will jump to the next post. But I want to change this so the user jumps to the first filed in the same post or stays in the last field of the same post. Mayb...

how do I express the term if x is integer in VBA language ?

Hi , how do I express the term if x is integer in VBA language ? I want to write a code that does something if x is integer and does something else if its not with vba excel. Sub dim() Dim x is Variant 'if x is integer Then 'Else: End Sub ...

How to query Microsoft Access Database fields from VBA in Excel

Hey guys, I am currently writing a program to save stuff entered in a form in Excel into a database in Access. I am trying to increment a primary key field within Access by "1" whenever I add data from the fields in my Excel form. Because I have declared this field as a PRIMARY KEY NOT NULL field, it doesn't allow me add another row o...

How do I make sure an OptionButton.Value has been chosen

Hi guys, I currently making an Excel VB application. However, I am stuck at the moment. I am trying to make the choice between two OptionButtons compulsory. I tried the code If Me.PWebOption.Value = False & Me.BWebOption = False Then MsgBox "Please choose a type of website" Exit Sub End If But this is not giving me ...

Outlook VBA: add category on open item

Is it possible in Microsoft Outlook VBA to catch the Open event of any mail item that gets opened? I'd like to add a category label to any mail item I have opened, to have an alternative 'unread' option I could script against for something else. I've tried this: Private Sub MailItem_Open() MsgBox "test" End Sub ...

Accessing same-named COM-entities from .NET assemblies

Hi to everyone. I've got a tiny (I hope) problem again, and I don't know how to obtain access to some presentation properties provided by PowerPoint (however I don't even know how to google it or search it at the site :( ) from C#. Let me explain. We can access a TextRange property both in C# and VBA, via an interop assembly and ms-offi...

Copy Text from Range in Excel into Word Document

hi, how do you: 1) copy text from a range in an Excel Document. 2) Open a Word Document. 3) inserts the text into a specific part of the word document. regards Kojo Edit: here is the approach Dim wrdApp As Word.Application Dim wrdDoc As Word.Document Dim j As Integer Set wrdApp = CreateObject("Word.Application") wrdApp.Visi...

How to extract shape coordinates in Word VBA

I'm trying to write a VBA macro in Word that will extract shapes and build them in Visio. I'm having some trouble getting the X Y coordinates of the shape in the document. I have tried using the Top and Left properties of the shape objects. The Left property seems to work fine, but the Top doesn't seem to work properly. A shape near th...

Can't close userform

Let me set up the environment. This is VBA code running in Excel. I have a userform that contains a mxflexgrid. This flexgrid shows a list of customers and the customer', salesperson, csr, mfg rep, and territories, assignments. When you click in a column, let's say under the Territory column, another userform opens to show a list of T...