vba

LoadfromText gives error 2285 (Microsoft Office Access can't create the output file)

When importing forms in access using loadfromtext, I continually get a runtime error 2285. Searching the internet shows many people with the same problem, yet no solutions. Does anyone know what causes this bug? Edit: In addition a file called 'errors.txt' is created in the folder containing the database. Edit: Sort of solution: I neve...

Excel VBA to VB.Net

Can anyone please convert this Excel generated VBA code to vb.net? I need to access the Selection.ListObject.QueryTable object in order to preserve the column width. Thanks!! Range("B9").Select() With Selection.ListObject.QueryTable .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = ...

How to make a macro which executes periodically in Excel?

How does one execute some VBA code periodically, completely automated? ...

How to refresh an access form

I am building an MS Access application in which all the forms are modal. However, after data change in a form, I want to refresh the parent form of this form with newer data. Is there any way to do it. To elaborate further : Consider there are two forms, Form A and Form B. Both are modal form. From Form A, I initiate Form B, and now For...

Is there a way to prevent extra elements in VBA dynamic arrays?

As the title states, is there a way to prevent extra elements from showing up in VBA dynamic arrays when they are non-zero based? For example, when using code similar to the following: While Cells(ndx, 1).Value <> vbNullString ReDim Preserve data(1 To (UBound(data) + 1)) ndx = ndx + 1 Wend You have an extra empty array eleme...

Excel VBA Load Addins

I am trying to create a new instance of Excel using VBA using: Set XlApp = New Excel.Application The problem is that this new instance of Excel doesn't load all the addins that load when I open Excel normally...Is there anything in the Excel Application object for loading in all the user-specified addins? I'm not trying to load a spec...

Relative instead of Absolute paths in Excel VBA

I have written an Excel VBA macro which imports data from a HTML file (stored locally) before performing calculations on the data. At the moment the HTML file is referred to with an absolute path: Workbooks.Open FileName:="C:\Documents and Settings\Senior Caterer\My Documents\Endurance Calculation\TRICATEndurance Summary.html" Howeve...

Strings containing double quotes in Excel

How can I construct the following string in an Excel formula: Maurice "The Rocket" Richard If I'm using single quotes, it's trivial = "Maurice 'The Rocket' Richard" but what about double quotes? Thanks ...

Controlling size of forms in Access

So I have an Access application, and I'd like some forms to be maximised when they are opened, and others to be medium-sized when they are opened. However, if I try something like this: Private Sub Form_Activate() DoCmd.Maximize End Sub or Private Sub Form_Activate() DoCmd.Restore End Sub it has the effect of maximizing or res...

How can I access the progress bar in an Office application's status bar.

I build VBA applications for both Word and Excel, is there any way to access the progress bar that sometimes appears in the Office status bar. ...

How can I build Word fields with VBA

Apart from just inserting and parsing text into a blank Word field, is there any way to programatically build user-defined fields and field codes into my own templates with VBA? Furthermore, is there a way to make these fields show up in the list of available fields? ...

How can I URL encode a string in Excel VBA?

Is there a built-in way to URL encode a string in Excel VBA or do I need to hand roll this functionality? ...

Catch a Paste Event?

I work for a custom cabinetry manufacturer and we write our own pricing program for our product. I have a form that has a pop-up box so the user can select which side the hinge will be on for ambiguous doors on that cabinet. I've got that to work so far, but when they copy an item and paste it at the bottom I don't want the pop-up box ...

Cloning Objects in VBA?

Is there a generic way to clone objects in VBA? So that i could copy x to y instead of copying just the pointer? Dim x As New Class1 Dim y As Class1 x.Color = 1 x.Height = 1 Set y = x y.Color = 2 Debug.Print "x.Color=" & x.Color & ", x.Height=" & x.Height By generic i mean something like Set y = CloneObject(x) rather ...

How to protect image on Excel sheet

I have an Excel worksheet with an image (logo). If I right-click on the picture and select Format Picture / Protection, the "Locked" checkbox is checked. I then protect the worksheet with a password. Despite all of the above, the end user can still select and delete the image. Is there any way to prevent this? Update Indeed Edit Objec...

What are the benefits of MS Word content controls ?

Office 2007 brings a new goodie called as 'content controls'. I need to evaluate this to see if this serves as a solution for a problem under research. Due to paucity of time and my general disdain for Office-interop-pains, can someone summarize the benefits? Is it possible to define custom content controls? where do all the word pro...

Browse for a File from Excel VBA

How can I put up a "File Open" dialog from some VBA running in Excel? I'm using Excel 2003. ...

Find CorelDraw Web links

Does anyone know how to get the Web links in a CorelDraw document? I am using CorelDraw 13 X3 on Windows, and it comes with a Link manager and VBA. ...

Recovering VBA password for Access 2000 file

It's the usual story, Access 2000 file created by former employee who protected the VBA code with a password. Now, some time later, the VBA code needs to be changed and we're unable to extract the password from the former employee. Searching online gives dozens of tools claiming to recover VBA passwords, but they have a wiff of Trojan a...

Running code before any forms open in Access

So I have an Access database with a front and a back end. I will be distributing it to users soon, but I have no control over where exactly they will put the files on their computers. However, I think I can count on them putting front and back ends in the same folder. As such, when the front end opens, I want it to check that the link...