vba

How to call a Macro in Microsoft Word 2003

I need to reinforce the structure of a Microsoft Word document. EG: Style Question here blah blah blah Style Answer Here blah blahblah The enforcement here would be the "Answer" style cannot be placed unless there is a "Question" style above it. To do this I would use a Macro, so ideally I would like to call my Macro everytime the doc...

Opening an IXOS archive doc programmatically

I need to do something very simple in VBA- open an IXOS archive doc in IXOS e-CON Desktop, based on specified doc ID. Tried to google it and found that IXOS has an ODMA interface that could be used but looking at the documentation I'm a bit lost.. could anyone give a code example? ...

Excel VBA Project - Password Removal

How can I programmatically remove a (known) password from an Excel VBA project? To be clear; I want to remove the password from the VBA Project, not the workbook or any worksheets. ...

Getting the headings from a Word document

How do I get a list of all the headings in a word document by using VBA? ...

MS Access: How to bypass/suppress an error?

i am executing a query like this select field from table; here there is a loop running on many tables so if a field is not present in a table i get a runtime error 3061. how can i by pass this error such as that on this error flow should goto another point this is the code I have at present after goin through this forum Option Expl...

VBA animation of Visio objects

Hello, I'm trying to animate Visio objects with a loop, such as: For reposition = 2 To 6 xpos = reposition ypos = reposition sh1.SetCenter xpos, ypos Sleep 1000 Next reposition While this DOES move the object from the starting position to the ending, the intermediate steps are not visible. After a delay only the final po...

Passing parameter to VBA Macro

I am trying to run a macro when I double click on Visio shapes. I want to pass the shape object to the VBA macro so that I could do something in the macro depending on the id of the Shape object. Is it possible to pass the parameter to VBA macro. If yes, please let me know how? Thanks. ...

How to write data from access to excel file

I am trying to use the following code to write data into an excel file Dim objexcel As Excel.Application Dim wbexcel As Excel.Workbook Dim wbExists As Boolean Set objexcel = CreateObject("excel.Application") objexcel.Visible = True ...

What's the best way to get the last non-empty worksheet in Excel (VBA)

I'm trying to write a VBA macro for a group that has one workbook where they daily create new worksheets, but they also have Sheet 1, Sheet 2, Sheet 3 at the end of their long list of sheets. I need to create a external cell reference in a new column in a different workbook where this information is being summarized, so I need to know ho...

How to return a range of cells in VBA without using a loop?

Hi, let's say I have a excel spread sheet like below: col1 col2 ------------ dog1 dog dog2 dog dog3 dog dog4 dog cat1 cat cat2 cat cat3 cat I want to return a range of cells (dog1,dog2,dog3,dog4) or (cat1,cat2,cat3) based on either "dog" or "cat" I know I can do a loop to check one by one, but is there any other me...

VBA: Add property to class

I would like to do something like add a nice-to-Excel-functions Name property to the WorkBook class. Is there a good way to do this? More detailed problem: In VBA you can assign a formula to a range in an Excel worksheet. I want to do so, and I want my formula to refer to a second workbook, which is an object called wb in my code. I the...

Iterating unregistered add-ins (.xla) in Excel 2003

Hi, I need help in figuring out how to iterate through currently open Excel add-in files (.xla) that have not been registered in Excel using the Tools > Add-ins menu path. More specifically, I am interested in any workbook that doesn't appear in the Add-In dialog, but has ThisWorkbook.IsAddin = True. Demonstrating the issue: Trying to...

Excel 2007 VBA and WMI - Current DOMAIN\USER

...

Can I programatically control the 'Rotate 180 Degree checkbox' option in HP Printer Driver settings with VBA ?

I'm trying to switch on and off the Rotate 180 degree setting for a HP Laser jet printer (4200/ 4350) using a duplexer unit. The Business has a requirement to "print on both sides", for maximum control I'd like to be able to manipulate at print time (through print macros) whether or not duplex printing is enabled for each of the differe...

Excel VBA hide/show row code speed.

Not sure how many Excel VBA gurus, besides myself ;-D, that hang around stackoverflow but here's an interesting question. Goal: Efficiently show/hide rows based on the data in the row. Create a helper column that determines whether or not a row should be hidden. Have the formula in the helper column return an error or a number. Hide ...

How do I programmatically change the line colour for a series in a chart in Excel 2007

I have a chart with a series that denotes a large set (1000's) of discrete measurements. Some of these are bad measurements and I want to colour the line for the series based on another set of data that describes how accurate the measurements are. Bad measurements should be red and good measurements green and the in between on some kind ...

Why does Excel macro work in Excel but not when called from Python?

I have an Excel macro that deletes a sheet, copies another sheet and renames it to the same name of the deleted sheet. This works fine when run from Excel, but when I run it by calling the macro from Python I get the following error message: ' Run-time error '1004': Cannot rename a sheet to the same name as another sheet, a referenced o...

access vba: Runtime error 3734

Hi, Can anyone give me details of runtime error 3734 in Access vba. For reference i am getting it from a code in the following thread http://stackoverflow.com/questions/233026/how-to-run-a-loop-of-queries-in-access Sub plausibt_check() Dim rs As DAO.Recordset Dim rs2 As ADODB.Recordset Dim db As database Dim strsql As String Dim tdf ...

VBA tutorial

Hi, At work I need to do lot of stuff with MS-Office and I managed to 'write' some scripts that do stuff instead of me. I copy-pasted it, changed some strings maybe. It is very frustrating to just copy paste and not understand how to do it your self, for every simple thing google for something. I am not completly new to programming, jus...

How do I set selection to Nothing when programming Excel using VBA?

When I create a graph after using range.copy and range.paste it leaves the paste range selected, and then when I create a graph a few lines later, it uses the selection as the first series in the plot. I can delete the series, but is there a more elegant way to do this? I tried Set selection = nothing but it won't let me set select...