vba

add item to right-click menu in Excel chart

How to add item to right-click menu in Excel chart using VBA? Excel is 2007. Chart is standalone sheet. ...

Creating a Powerpoint with Graphs from Access

I am trying to programmatically create a PowerPoint from graphs in Access. Ideally, when the graphs move over to PowerPoint they will become static pictures and not graphs still linked to the access data. I have tried procedures such as: Private Sub Command1_click() Dim pwrpnt as Object Dim Presentation as Object set p...

How do I set a query result equal to a variable in VBA?

I have a table titled MIUInfo. In it there are three columns; MIUID, Latitude, and Longitude. In it I'm running the following query which gets the number of MIUIDs in the criteria range. SELECT Count(MIUInfo.MIUID) From MIUInfo WHERE ((MIUInfo.Latitude Between " & minLat & " And " & maxLat & ") AND (MIUInfo.Longitude...

Update SQL table with bigint field from VBA (MS Access)

enter code hereI have a table on SQL server 2005 with bigint primary key and MS Access 2003 front end (linked tables). I want to update the record for the table that has bigint as primarykey. I use CurentDb.execute _ "Update myTable SET Field1 =1 , Field2 = 'test' WHERE bigintKey = " & myVar I get Data mismatch in criteria expre...

Programmatic positioning of VBA charts has stopped working

I was using this routine, triggered by the Worksheet_Change event, to display a selected chart and move all other charts to a holding position off screen. Sub shuffleCharts(chartName As String) Dim analysisChart As ChartObject For Each analysisChart In ActiveSheet.ChartObjects With analysisChart .Left = 1575...

ADO Batch Update in Access VBA

I am trying to use batch updates in Access VBA. My code works fine when I update after every operation, but fails when I try to operate on multiple rows. The exception I get is "Run-time error '-2147217887 (80040e21)': Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done." ...

Word vba - if cursor is in cell / bookmark - run code

Hi, I have a template document which contains several sections and a few tables. The thing is, I'm trying to insert a drop-down list inside on of the cells in the table. And for a drop-down list to work, the document needs to be protected. But if I protect the entire section the table is in, the entire table is protected. So, I was w...

loading formatted data in VBA from a text file

I'm looking for the best way of loading formatted data in VBA. I’ve spent quite some time trying to find the equivalent of C-like or Fortran-like fscanf type functions, but without success. Basically I want to read from a text file millions of numbers placed on many (100,000’s) lines with 10 numbers each (except the last line, possibly...

Access 2007, Textbox search box like the Facebook name search box on the top right

Hi, so basically I have an AddCompany Form, where theres a textbox [CompanyName], i want to type a new company name in there, but meanwhile check if theres an already existing one. So for example,say i want to type Microsoft, when i type M, the textbox shows whole bunch of other names with M, and then keeps going until I type finish ty...

Excel function Fill Up Cells

Consider the following data on excel(which you have to create in excel): Numbers 0.2 0.2 3.4 1.5 1.8 4.2 Write a VBA function that scans through the selection, finds the empty spots and then t fills them with a numerical value which is passed through the signature of the function. Output: Numbers 0.2 0.2 3.4 0 1.5 1.8 0.0 4.2 Hi ...

Problem in WHERE clause (don't know how I can address results from DECODE() function in WHERE clause).

I have a rather simple PL/SQL query (...) DECODE(upper(Table.Column), 'SOMETHING', '---', TABLE2.COLUMN2) as VALUE (...) How can I apply the WHERE clause using above statement, because when I use something like: WHERE upper(VALUE) like 'SOMETHING' it gives me an empty recordset (and I am absolutely positive that there are records w...

In VBA, cannot use Access.Application object

This does NOT work: Sub X() Dim A As Access.Application Set A = CreateObject("Access.Application") 'Do Stuff End Sub However, this DOES work: Sub X() Dim A As Object Set A = CreateObject("Access.Application") 'Do Stuff End Sub I know they do virtually the same thing, but can anyone tell me how to make an acc...

How can I count to 10 while summing the numbers in Excel VBA?

How can I count to 10 while summing the numbers in VBA? ...

c# excel: where is VBComponents...

hi i am working with c# and excel-2007... i wanted to add a macro to excel and run from c#, for which i think i need access to the VBComponents but unfortunately i cannot see it after i do the following wb.VBProject. should i add any com objects? or what should i do to see the VBComponents... i already have using Excel = Mi...

How can I tell what module my code is executing in?

For a very long time, when I have an error handler I make it report what Project, Module, and Procedure the error was thrown in. I have always accomplished this by simply storing their name via constants. I know that in a Class you get the name programmatically with TypeName(Me), but obviously that only gets me one out of three pieces o...

macro problem

I'm trying to run the below mentioned code in VB(Excel Macro) but i m stuck with an error which pops up on running saying "Automation Error". strComputer = "." Set objNetwork = CreateObject("Wscript.Network") Set fs = CreateObject("Scripting.FileSystemObject") Set objWMIService = GetObject("winmgmts:\" & strComputer & "\root\cimv2"...

How to change Named Range Scope

When I create a named range through the Name Manager, I'm given the option of specifying Workbook or [worksheet name] scope. But if then want to change scope, the drop-down is grayed out. Is there a way, in either Name Manager or, preferablly, VBA to change the scope of an existing named range? For example, 'testName' refers to 'shee...

VBA - Create a new object using the text name of the class

Is there a way to set an object to the new instance of a class by using the text name of the class? I will have a library of classes, and depending on some other variable, I want to get one of these classes at runtime. E.g. I have "CTest1", "CTest2", "CTest3" I would have function similar to the below Function GetTestClass(lngClassNo...

How do I invoke the IE 'onblur' event from VBA code in Excel?

Situation: I am working to populate text entry boxes in a webpage with data from Excel. When the data is entered manually and the focus is moved to another text box, the 'onblur' event is fired to do input validation. Desire: I want to be able to cause the 'onblur' event to be fired when I populate the same text boxes from VBA code ...

hi help me in decryption using perl the encryption is done in VB

Public Function EncryptString(ByVal vstrStringToBeEnrypted As String) As String Dim sa As SymmetricAlgorithm = SymmetricAlgorithm.Create("TripleDES") sa.Key = Convert.FromBase64String("cPSQAC05GBXzMhRRz7tm8cqg+vHdHyN5") sa.IV = Convert.FromBase64String("jIShBJVBfXo=") Dim inputByteArray() As Byte = Encoding.ASCII.GetByt...