vba

Excel VBA 424 Object Required Runtime Error

As an exercise, I'm trying to set all the values in the range A1:V35 to "omg". The following code produces an error: Sub ktr() Dim colIndex As Integer Dim rowIndex As Integer Dim dataRange As Range Set dataRange = Range("A1:V35") Cells(1, 1) = dataRange.Columns.Count For colIndex = 1 To dataRange.Columns.Cou...

VBA and Private Functions

For some reason, nothing happens when I run this macro. What might I be doing wrong? (I'm trying to fill each cell in the range with a randomly selected string.) Sub ktr() Dim dataRange As Range Set dataRange = Range("A1:V35") For Each cell In dataRange response = azerothSays() cell.Value = response N...

Outlook VBA script failing with null reference error, but the objects aren't null

I've got an Outlook VBA script which calls on a custom dll to perform a particular function. The assembly is compiled to be COM visible, but is not strong named due because of a myriad of dependencies, and thus is not registered in the GAC. To work around that, I've simply placed the assembly and it's dependencies in the appropriate Pr...

Excel copy worksheet

In Excel VBA (or if you could in C#, I'm using the Excels Object Library from .NET), how to copy a worksheet from one workbook to another sheet in another workbook. Basically, what I'm doing is copying every of my sheet into a central worksheet in another workbook and then will do all the stuff I need to do there. I tried using Range.Cop...

How do I export a Gantt Chart from MS Project to MS Word using VBA

Using MS Project 2003 i want to export the "View | Gantt Chart" to MS Word (2000) using VBA. How can I achieve this? ...

can't set PageSetup.Orientation = xlLandscape from MS Project

Using VBA in MS Project 2003 I create an Excel sheet and write data to it. After that I want to change SetPrintArea and Orientation of the sheet I created so I wrote with xlsheet '// Defined being an Excel.Worksheet For i = 1 To .UsedRange.Columns.Count .Columns(i).EntireColumn.AutoFit Next i ...

Excel VBA: Subtotals?

I have data of this form: Category Source Amount Dues FTW $100 Donations ODP $20 Donations IOI $33 Dues MMK $124 Where there is no sort order. I want a VBA macro to cycle through the range, output a list of distinct values, with the subtotals for each. For the above d...

How do I find where a missing reference is used in MS Access

I have a missing reference listed in my References list (in the VBA Code view). It's a reference to an OCX for a product that we no longer use. I'm fine with removing(unchecking) the reference, but I'm wondering if that is going to come back to bite me. Is there a way to find out in which forms/reports it might have been used? Is rem...

Excel: Formula to reference an entire pivot table?

I have a bunch of sheets with detailed data sets and pivot tables. On a summary sheet, I want to display just the pivot tables. (Of course, I'd rather stay DRY and not create a whole new set.) How can I reference the old pivot tables? I can use VBA to do this if necessary. ...

onLoad="MyOnLoad"

hello does anybody have any idea what's does this mean: onLoad="MyOnLoad"? thanks ...

VBA macro fails when run on another machine

I have Custom object modules and such ... When I send it via email or Msn the other party gets a compile error. It cannot find my ObjectModule ... Any idea on what's happening? Regards ...

Finding similar sounding text in VBA

My manager tells me that there is a way to evaluate names that are spelled differently but sound similar in the way they are pronounced. Ideally, we want to be able to evaluate a user-entered search name and return exact matches as well as "similar sounding" names. He called the process "Soundits" but I cannot find any info on Google. ...

Close a RecordSet in a form but still display the last data it contained (access 2003)

I'm working on a bit of Access 2003 VBA code that pulls data from a temporary table and shows it in a forms recordset, I then need to delete the temp table but I can't do this until I've disconnected from the Recordset, which removes the data. What can I call instead of Recordset.Close or RecordSource = "" which would keep the data on ...

vba excel how to paste values without font/color/bg color formatting

Got a macro to copy a summary row from each of a series of worksheets. Summary row is specially formatted with font/font color/bg color, but when pasted into the 'sumamry sheet' needs to just paste values without formatting. For LoopIndex = StartIndex To EndIndex ' start in a task sheet Sheets(LoopIndex).Select CopiedCells ...

Does X509Certificate2 functionality exist in VBA ?

I have a VBA application that returns an HTTPS file but it stops to ask for the Certificate. C# has this code: Dim wr As HttpWebRequest = CType(WebRequest.Create("https://www.xxx.net?RunDate=2009-09-29"), HttpWebRequest) wr.ClientCertificates.Add(New System.Security.Cryptography.X509Certificates.X509Certificate2(myCert, myCertPW)) Is...

User Defined Multiple Column Sort in Excel

Hello, I have few hundred rows of data in four columns (varA, varB, varC, varD). I want to write a macro such that a user can define the sort order of these columns i.e. first sort by varD, then by varA, varC, varB...so on and so forth. In all there are 4! or 24 different permutation possibilities. I DO NOT WANT THE USERS TO GO DIRECTLY...

Using Class Module in VBA give error.

Hi, I get an "object variable or With block variable not set " error in the following code. Th line that gets the error is all = GetPayAllocation(rsPrj, 10, 1) If I check the properties of the all variable they have values. Any ideas? Public Function tmptest1() Dim rsPrj As Recordset If Not Connection Then Exit Function gSQL = "...

EXCEL VBA - To open a text file from a website

I want to read from a read the text file from a website such as www.site.com/example.txt and update an tabs in an excel sheet accordingly. Is it possible using excel VBA? Can you advise some examples? ...

Autonumber value of last inserted row - MS Access / VBA

I have a JET table with an auto-number as the primary key, and I would like to know how I can retrieve this number after inserting a row. I have thought of using MAX() to retrieve the row with the highest value, but am not sure how reliable this would be. Some sample code: Dim query As String Dim newRow As Integer query = "INSERT INTO...

How to convert into date format?

Using Access 2003 Date Column datatype is text Table1 Date 20090528 20090529 20090530 20090502 20090504 Expected Output 28-May-2009 29-May-2009 30-May-2009 02-May-2009 04-May-2009 ..., How to make a query for the Expected Output Date format? ...