vba

trying to launch a macro when the value of a DDE range changes

Hi there, I'm a novice in VBA but still I need yo execute a macro every time the value of a range changes. The marco is already written but if someone can help me with this issue, I will be very grateful. Just as you know the changing range is a DDE link updating the range with a continuous flow Thxs for your help ...

Placing variable number of variables into fields in table

I am trying to make a generic notInList function that is called when the user types a value in a combobox that is not part of the list. In middle of that function, I want to insert the new value(s) into a table. For some of the combo-boxes, more than one field has to be filled out in the table. (The user is asked a follow-up question ...

How can I produce student-style graphs using matplotlib?

I am experimenting with matplotlib at the moment. Some time ago I used Excel VBA code to produce images such as the one attached. You will notice it is not presented in a scientific/research style but rather as if produced by a school-student on graph paper - with three different grid-line styles. Is there a fairly straightforward way ...

Need help with the DLookUp function

Here is my dlookup function: DlookUp("IsVague", "CommodityType", "Description = " & newItem) newItem is a variable that contains "in it in list". The datatype for the description field is varchar(50). The dlookup function is giving me an error: Incorrect syntax near the keyword "is". What could be wrong? ...

Inserting value into Excel cell instead of formula

Hi, I have a VBA script that inserts long strings into Excel cells. In some cases, the string begins with a '='. It seems like Excel interprets this as a formula and I get an 'Out of Memory' error due to the memory limitations of formulas. How do I tell Excel that I am writing a value, not a formula? Currently, I am doing this: ws.Ran...

Which is better practice: complex SQL statements or Recordset manipulation in Access VBA?

I'm doing some VBA development and I found creating SQLs quite efficient way of getting everything done (selecting and updating). But I got to this stage where my SQL statements contain complex Switches and WHERE conditions where I have another Selects to update appropriate records. Therefore, I create this SQLs and I simply run it via ...

Set Excel Named Ranges via C#?

Hi, I'm trying to replicate this Access VBA code using C#, but am unable to do so. Wondering if anyone else has tried this before and can help. oWB.Worksheets("Signoff").Range("rgSignOffRecTemplate").Value = g_TemplatePath & "Signoff_Rec.XLT" rgSignOffRecTemplate is a "Defined Name" in the Excel template that I'm trying to write to. ...

How can I use an Access query which uses Access-VBA-defined functions in Word VBA?

State of the question: I no longer think it is relevant that I'm referencing Excel or that the query has parameters. I think question boils down to this: How can I use an Access query which uses Access-VBA-defined functions in Word VBA? What I want to do is impossible, how can I make an inlined version of the Acos function work with my...

Do CopyFile and CopyFileEx work if the source file is open?

I want to call a copyFile function from within the source file to be copied. The VBA FileCopy function does not allow the source file to be open while it is copied. I am thinking of using CopyFile or CopyFileEx (to show a progress bar) instead. Therefore, do those functions work if the source file is open? ...

Sign a Word VBA project/file via command line or other form of automation

Is there a way to automate code signing a VBA project in a Word 2003 and/or Word 2007 document? By automate I mean via a command line utility or via Word VBA automation? Motivation: I would like to code sign several Word templates as part of an automated daily build and distribution cycle. Right now we have to do this manually by openi...

everyday, I have to arrange all data of Market : SPOT in excel file, So could any one help to provide excel VBA tips

Sample raw Data :- Market : Oddlot ______________________________________________________________________________________________________________ CUSTOMER |INSTRUMENT| BROKER | CONTRACT| TRADE | BOUGHT | SOLD | PRICE | HOWLA | LAGA | HOWLA | | ORDER | NO | TIME | | | ...

In an Access form, how to return to previous record after requery

This should be an easy one. This form is filtered by [Dismissed] = "N". When the user clicks the "Dismiss" button, the [Dismissed] field changes to "Y". After the requery, the form should then return to the same row where the user was previously at. Private Sub DismissButton_Click() Me!Dismissed = "Y" MsgBox "Dismissed!", vbOK...

Updating target workbook - extracting data from source workbook

My question is as follows: I have given a workbook to multiple people. They have this workbook in a folder of their choice. The workbook name is the same for all people, but folder locations vary. Let's assume the common file name is MyData-1.xls. Now I have updated the workbook and want to give it to these people. However when they r...

In MS Access form, how to color background of selected record?

I have a somewhat complicated looking Access Form with a continuous display (meaning multiple records are shown at once). I'd like to change the background color of the selected record only so the end-user can easily tell which record they are on. I'm thinking of perhaps a conditional format or maybe something like this: Private Sub D...

Excel: Is there information on how to create web query service in Excel?

In Excel, there are methods to access data from external data sources. Excel comes with MSN Money Web Service which pulls data into the sheet. The sheet can refresh the data, etc.. Is there info/doc on how to develop such service ? ...

Remove Add-in UI on uninstall

I have an outlook add-in which runs only on the first startup of Outlook, at which point it creates a toolbox and adds it to Outlook's command bar. I used this approach rather than creating a temporary UI on each startup because I want the user's decisions about the control to be persistent; if the user disables the control or moves it,...

In an MS Access Maketable query, how to create an Autonumber field?

I have a Maketable query in an Access db that could use an Autonumber field. I can't find a built-in function for my purpose. Do i need to write my own? Ideally, I'd just like to create a field in the Access designer as "Autonum: CreateAutoNumber()" Edit: If it can't be done in the query itself, I can also run a procedure afterward. ...

Problem with reading excel cell value to a VARIANT

hi, I'm reading a excel cell value to a VARIANT data type from VBA code. When I enter a integer value to the cell, the VARIANT always takes the argument as type double. Please help me to rectify this problem. Thank you ...

Event Log in VBA

Is there an easy way to write to and read from the windows event log in VBA? ...

Associate a help file with a library in the VBA object brower

I have a reference to the Microsoft Scripting Runtime (scrrun.dll) in one of my Access projects. If I open the object browser in VBA (by pressing F2) and choose 'Scripting' from the library dropdown it shows me all of the properties, functions, etc. for the Scripting library. If I choose one of these functions and then click on the hel...