vba

Copy method fail due to memory

In my workbook, I copy the current sheet to keep as a record of a sale. Eventually, the workbook fills up with sales and at some point throws an error when I try to copy another sheet. After saving, then completely exiting Excel, then reloading the file, I can continue without problems. I'm guessing it's a memory issue, but I'm not qu...

C# COM Interop Library

Hey all, I am currently porting a legacy VBA application to a .Net application. During this process the users of the existing VBA application need to have some features added. So instead of coding them in VBA & then later in C#, I’ve wrote the new functionality in C# and I want to expose this to the existing VBA application through COM, ...

excel macro help needed... to match if e.g. 500 to -500 then..

in a if statement, how do i match a positive number with a negative one e.g. if 500 match with -500, cut and paste one solution i thought of is changing one of the column by *-1 before i do anything but... Is there anyway i could rephase the below if statement to match a positive cell and a negative cell? Dim sh1 As Worksheet, sh2 As...

How to switch between "active paper" and "slides" in Power Point VBA

Hello everybody, I have a simple question regarding PowerPoint VBA: Which VBA code should I use to switch between the "active sheet of paper" (I am sorry I don't know how to name it properly), in which I am doing something with the object(s), and the file (or "field", again sorry for my poor terminology) where all the slides are ? Fo...

Selecting a particular cell in Excel

I have two Excel sheets. The first one has some data. The second has updated data and should be used to alter specific information on the first sheet. For example: If I had (in the first sheet) employee wage and his number and in the second sheet also. I want to write code that will find the employee number in the second sheet and chang...

XML Import in Excel 2003 Standard Edition

We have built an Excel 2003 template that asks the user to select an XML file which is then imported into an XML Map and used to populate a worksheet. Unfortunately it turns out that the users have Excel Standard Edition, which does not include the XML import functionality - namely the Workbook.XmlImport function. Users are able to ope...

How to create dots in Power Point VBA, move them around in different directions while keeping them connected with straight lines?

Hello everybody. There is one thing I want to do in PowerPoint VBA. I want to create two dots in the main window - dot A and dot B - by their given coordinates: for example, A (232, 464) and B (109, 567). I don't know how to do it in PowerPoint VBA. I know how to create a simple straight line. I use this macro code for that: Sub Crea...

Access VBA. How to execute many buttons using a single button?

I have a form with a few buttons. I want create a button which will execute all the buttons one after the other, after each function of the buttons has completed. Also, I would like to change the colour of the buttons to show which button is being executed. How do I do this? ...

How to make a loop in PowerPoint VBA?

As far as I know, the code below gets a shape from the active window, nudges it a bit, copies the slide and pastes it right after the current one, then turns the pasted slide into an active window, and nudges it again: Sub Test() ' Get the active presentation Dim oPresentation As Presentation Set oPresentation = ActivePresentation ...

Adding text / input box rendering to Access for a guided user interface experience

For software used in a call centre guiding agents through a set script they must follow while on telephone calls, with the script branching dependant on answers to questions given - My system uses a MS Access / VBA front end (isnt web based due to speed, phone integration), 'call scripting' is coded in VBA when needed, but what if i want...

In PowerPoint VBA, how to nudge all the present shapes in the window (not only one)?

As far as I understand, this code "grabs" only the first shape in the active window and nudges it: Set oShape = oSlide.Shapes(1) oShape.Left = oShape.Left + 5 How can I "grab" all the shapes in the window and nudge them all at once? ...

Cancel External Query in Excel VBA

I have created an Excel Spreadsheet which helps with data analysis from an Oracle database. The user enters then clicks the "Refresh Query" button which generates a query for Oracle to execute. The query takes a minute or so to complete. Although the VBA code does not hang on ".Refresh", all Excel windows remain frozen until the que...

How to do the square root in PowerPoint VBA?

Here is some math code that adds A to B: Sub math() A = 23 B = 2 ABSumTotal = A + B strMsg = "The answer is " & "$" & ABSumTotal & "." MsgBox strMsg End Sub But how can I calculate a square root of ABSumTotal? Is it possible in PowerPoint VBA? ...

VBA: How to perform an action on specific elements of an array

In VBA for PowerPoint, as far as I understand, this code gets only the first shape in the active window and nudges it: Set oShape = oSlide.Shapes(1) oShape.Left = oShape.Left + 5 And if I wanted to nudge all the shapes, I would use a loop for this. But how can I get and nudge only certain shapes, based on their number? For exampl...

What tutorial you would recommend to study PowerPoint VBA?

I feel I lack some real basics and I feel I would waste your time if ask all those basic questions here. Can you please recommend a good PowerPoint VBA tutorial that would explain basics to me. A tutorial povided with examples is prefered. ...

Is there a future for PowerPoint VBA/VSTO?

Does anyone know what the future holds for VBA/VSTO programming in PowerPoint? I've been working on a Office automation project and find it frustrating to work with PowerPoint in particular since it seems to be one level below VBA support found in Excel or Word. It feels like MS is trying to phase out support for VBA in PowerPointsinc...

MS Access. ADO recordset for subform. Child relationship set up programatically. Won't automatically fill in field.

I have a form/subform for inputting data into an ado table. The main form's recordset is a local table of Widgets and information about the widgets (WidgetID, WidgetName, size, color, location, etc). I am inputting test data (multiple tests per widget, all with unique dates) through the subform which is connected to an ADO recordset to...

Why does Excel throw an exception on Quit when started from command line?

I have a simple Excel file that queries a database when it opens and then closes automatically. If I double click the file to open it from within Windows Explorer (I'm running Windows XP and Excel 2002), it works fine. However, if I run it using Excel "C:\DataUpdate.xls" from Start > Run or from Shell within another instance of Exc...

Hiding columns in a Microsoft Access 2007 datasheet with VBA

I am trying to hide specific columns in an Access 2007 split form through code. I need the form to check certain conditions to see whether it needs to display a column or not. I have code in the form's 'Activate' event to hide the column like this: txtControl.ColumnHidden = True This code works in the "Open" event, but if I hide the c...

Why does this code in VBA Power Point work fine witout Dim commands for numbers?

From one of VBA tutorials I learned that variables contining numbers should be firstly declared as integers: Dim mynumber as integer But, please, look at this code: Sub math() A = 23 B = 2 ABSumTotal = A + B strMsg = "The answer is " & "$" & ABSumTotal & "." MsgBox strMsg strMsg = "The answer is " & "$" & Sqr(AB...