vba

How to fill-up cells within a Excel worksheet from a VBA function?

Hello, I simply want to fill-up cells in my spreadsheet from a VBA function. By example, I would like to type =FillHere() in a cell, and in result I will have a few cells filled-up with some data. I tried with such a function: Function FillHere() Dim rngCaller As Range Set rngCaller = Application.Caller rngCaller.Cells(1, 1) = "...

myString = "UPDATE " results in an empty myString

In MS Access assigning a string literal will sometimes result in an empty String The following code Public Sub test() Dim myString As String myString = "UPDATE " Debug.Print "'" & myString & "'" End Sub results in '' this is freaking me out. It only happens sometimes. Other times the "UPDATE " will work, but myString ...

How can I use JavaScript within an Excel macro?

There’s a really cool diff class hosted by Google here: http://code.google.com/p/google-diff-match-patch/ I’ve used it before on a few web sites, but now I need to use it within an Excel macro to compare text between two cells. However, it is only available in JavaScript, Python, Java, and C++, not VBA. My users are limited to Excel ...

Outlook: How do I POST the selected message to a web server using VBA?

Goal: To have a button in the Outlook toolbar which, when pressed, sends the current message in it's entirety (perhaps as a .msg file) via post to a URL. Some kind of browser window must be opened in the process so the user can enter login details for the application at the URL (unless I can get around this somehow, thoughts?). I have c...

Access VBA Error 2486 DoCmd.Save

We are importing some code modules into an Access 2002 application using the below line in VBA Application.VBE.ActiveVBProject.VBComponents.Import (strFileName) This part works fine, the line immediately following attempts to save the new class to the project. The only way that we can see to do this is using DoCmd: DoCmd.Save acModule...

Excel Calculations and VBA

In the following Excel spreadsheet, I need to make the following calculations: Input Color Selected Output ------- -------------- -------- 40 red 40x18 40 blue 40x12 40 green 40x16 40 yellow 40x13 39 ...

hiding an excel sheet

i have an excel spreadsheet with 3 tabs one of the tabs contains formulas for one of the other sheets and i was wondering if there is a way of hiding it?? ...

Creating tables for copy from Word to Excel

So, I needed to take some data done in MS Word tables, and manipulate in excel. I decided to get it from word to excel via a VBA subroutine to "save time". My source word document contained like twentysomething tables. I took my source document's tables, extracted my data and made a new document, with a new table, only needing me to ...

How can an Excel Add-In respond to events in any worksheet?

Our workbooks are server-generated SpreadsheetML, which cannot include any VBA code. Creating native Excel files or Excel 2007 XML files is also not an option, unfortunately. So, I have an Excel Add-In (VBA, not XLL) that each of our users installs to add some extra UDFs, etc. that our workbooks need. This works great, but now I need t...

Alternative to Application.LoadFromText for MS Access Queries

I am attempting to load from text files, queries into an MS Access Queries Collection using VBScript. I am using something like this: The code originated from Here. for each myFile in folder.Files objecttype = fso.GetExtensionName(myFile.Name) objectname = fso.GetBaseName(myFile.Name) WScript.Echo " " & objectname & " (" ...

Sort combobox values alphabetically

I have a combobox in a userform for excel. What is the easiest way to sort it alphabetically? The values for it are hardcoded in vba and new ones are just added to the bottom so they are not in any kind of order already. The userform is currently being used so that our users can import data from our database into excel. The combobox ...

Error handling in MS Excel VBA

Hi, I am having a bit of trouble with errors occurring in a loop in VBA. First, here is the code I am using dl = 20 For dnme = 1 To 3 Select Case dnme Case 1 drnme = kt + " 90" nme = "door90" drnme1 = nme Case 2 drnme = kt + " dec" nme = "door70" 'decorative glazed' Case 3 drnme = kt + " gl" nme = "door80" 'plain glazed' End Select On...

Excel triggered macro

I am struggling to carry out the following. Any help would be greatly appreciated. The marco only relates to one excel worksheet. I have 50 rows of information, 11 columns wide (A - K) in each row of column A there sits an IF condition If the IF condition flags the word 'OK' I would like a macro to trigger, and carry out the followin...

Excel/VBA to check if a row exists

I have a sheet full of some raw data, about 20,000 rows and 50 columns. (Number of rows expected to increase, probably double if not triple) I need a formula to look at this data and determine if a row exists for data in two specified columns. My current formula is as follows. Function CheckExists(Table As Range, SearchCol1 As Integer,...

How do I implement Zip functionality in VBA?

Hello, recently I have been working on an app in vba which relies on some files which are contained in the .docm file of the document its self. Initially, I was using the Windows XP compressed folder functionality to programmatically extract the contents of the docm. This was an optimal solution because it is built into all Windows XP ...

Programmatically set "Select objects" cursor in Excel

I'm struggling to find out how to programmatically enable the "Select objects" cursor type. I checked the object browser and expected to find a property like Application.CursorType or Application.DrawingMode. Changing the cursor type isn't picked up in the macro recorder and I must be searching for the wrong terms as I can't find infor...

Need VB to make Excel calculate a sheet or range in realtime and in the background

How can I make excel continuously calculate a sheet/range in realtime (not 1 calc/sec) and do it in the background? I want this metric clock to run like a stopwatch.... =IF(LEN(ROUND((HOUR(NOW())*(100/24)),0))=1,"0"&ROUND((HOUR(NOW())*(100/24)),0),ROUND((HOUR(NOW())*(100/24)),0))&":"&IF(LEN(ROUND((MINUTE(NOW())*(100/60)),0))=1,"0"&R...

Automating certain repetive actions in IE based applications via a c# tool?

http://www.xtremevbtalk.com/showthread.php?p=1221565#post1221565 This thread shows some discussion about what I'm trying to do. I can't use Powershell for this purpose and I'm not an advanced student, so my level is beginning intermediate. Understand concepts, but need lots of help and basic ideas :-) Can i use a simple control in c# t...

How to send + from the number pad in Excel/VBA?

I'm working on a project at work that, basically, does screen scraping. I'm using VBA to drive another system based on inputs stored in a spreadsheet. The problem I'm running into is that certain fields require a + from the number pad as a field-exit character. I have no problem using the SendKeys function to fill in the other fields,...

Capturing spreadsheet usage throughout a company

We have a lot of customized spreadsheet solutions that are being used and we want some programmatic way of keeping track of them. Obviously since they are spreadsheets, people can save them locally, rename them, etc so we need a solution that can account for that. Some ideas are: On spreadsheet open, handle the OnOpen event and write...