vba

Excel: How can I speed up a Find & Replace process? Changing 32,000 links per workbook.

I'm comparing a lot of data for over 30 categories. Each category workbook is saved into 'MyFolder' with it's own distinctive name (the category). The data in the workbook is found on a sheet with the same name as the category: [Category.xls]CategoryYear_Final! It seemed best to create a standard template that references the data and wh...

vba: storing a long string in a variable with special characters

i need to set a string equal to this in vba. how do i do it? <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourc...

vba: how do i search through a collection?

i am looking for a particular element in a collection. how do i know if it exists in the collection? ...

Getting questionmark characters (?) when reading file line by line into worksheet

I am reading a text file line by line with VBA into a worksheet. it's often returning these characters. Does anyone know how to remove them? this is how i am reading it: Sub ReadAsciiFile() Dim sFileName As String Dim iFileNum As Integer Dim sBuf As String Dim i As Integer i = 1 ' edit this: sFileName = ...

VBA: how do I sort a collection?

Does anyone know how to sort a collection in VBA? ...

How to return unique value from a range of values Excel VBA

I have a table with three fields (ID, Price, Date) in excel. It has four records as following: ID Price Date 1 $400 1/1/2010 2 $500 1/2/2010 3 $200 1/1/2010 4 $899 1/2/2010 I would like to take each value of the date and place it in a cell A2,A3,A4.... however, I want to take only unique dates and do not take any date tha...

Declaration of an array in Excel VBA

I have in a Excel field (created by someone) a formula containing an Array: =PERCENTILE(Scale1, 0.5). I need to expand this array to other fields. Usually an Array is a range like A1:C52, so expanding it means modifying the formula to, let's say A1:C152. But this "Scale1", even if I can see its border in a blue color, I can't modify i...

How to get an HTA to restart itself?

I have an HTML Application that I am using to build a kiosk environment. At the end of every session (when the user clicks "Logout" or after a timeout) I want the HTA to close itself and restart*. I was wondering how I would go about achieving this programatically with VBScript. The process should go something like this User clicks "l...

Slides.InsertFromFile deletes hyperlinks from SmartArt (PowerPoint 2007)

(Powerpoint 2007) I have a slide with a "Vertical block List" Smart-Art. It contains several bullets, some of which have hyperlinks in the text. When I use Slides.InsertFromFile to insert that slide into another presentation, the text of the hyperlinks is still underlined but the link address is empty. (same happens with a "Basic block...

Access Active Document in VBA when document is opening on the intranet

We have old Word templates that were originally written for Word 97. For each new version, we've updated the templates. Now we'll go from Word 2003 to Word 2010, and of course there are problems. The template contains the following code: Private Sub Document_Open() On Error Resume Next If ActiveDocument.Type = wdTypeDocument Th...

MS Access 2010: "collating sequence not supported with the specified file format"

I recently upgraded to MS Access 2010. When I open a certain .mdb (2000-2003 file format), I am greeted with this message: collating sequence not supported with the specified file format. I'm not sure what it means, but it gives it to me every time the database is opened. I have Googled around but found nothing that I thought seemed rel...

I want to save a file from a website embedded in a email using VBA in Outlook 2007

What I am trying to do is create a VBA macro that is triggered when a rule is invoked from a specific email that has a standard format in the subject header. When this rule is invoked it will scrap the email for a website address. The problem I have is I want to save a file to a specific location. The file accessed is not a file that c...

Why is there multiple Err.Number for the same Err.Description?

Hi, Reading various properties of the Outlook.MAPIFolder.Items collection results in an error when the user permissions are insufficient, for example if the folder is visible but no browsable. The error description is: You do not have sufficient permission to perform this operation on this object. See the folder contact or your system ...

Execute Access 2007 Report and Export that Report to PDF Programmatically?

I have a great report in an Access 2007 Database and would like to automate the execution and exportation of that report. Is this possible and what would be your first guess at the method needed to pull it off? ...

Excel macro to select and cut multiple rows to a new worksheet

I run a report every week and would like to cut the rows for a particular date range into a new worksheet (i.e. all rows with transactions between the 16th of one month to the 15th of the following month). I'd like to cut all rows between 07/16 and 08/15 and past them in a new worksheet called "Aug" And cut all rows between 08/16 and 09...

How to permanently allow macro for a trusted worksheet?

Hi I've created a worksheet which is shared amongst my colleagues with a real simply macro to show/hide rows but everytime either I or one of my colleagues opens it they get prompted to Allow marco - is there anyway for them to permantly allow this macro? ...

Module vs object-oriented programming in vba

My first "serious" language was Java, so I have comprehended object-oriented programming in sense that elemental brick of program is a class. Now I write on VBA and Python. There are module languages and I am feeling persistent discomfort: I don't know how should I decompose program in a modules/classes. I understand that one module cor...

Manipulate VBA environment from C# .Net (VS2008)

I need to manipulate the VBA environment of an application from a C# addin so I can add modules, event handlers etc to documents that are created by the addin. I've done it before in VB.Net but can't see how to get at the IDE object in C#. Am I just missing a reference or a Using directive? I can't see anything appropriate in the refere...

How to implement multi-threading and problem specific questions in vba

I have a spreadsheet with about 25 sheets. In some of the sheets specifically 6,7,13,17,18,19 I'm populating them with Database values. In some sheets I'm populating two table's data. Now I need to create a button which will do the following operation. On the button click event I need to traverse through all sheets and see if any sheet i...

Access's trim() function not recognized on another machine

I built a modest Access DB and asked a coworker to test it on her machine. To my surprise, an error message popped up, saying it didn't recognize Trim(). The query in question is a standard select query that pulls from a MSSQL Server DB. Why isn't it recognized on her machine and how do I get around this? (We both use MS Office 2003 an...