vba

How might I change the width of a field on an Access form at runtime?

I'm working to devise a custom layout system for my MS-Access forms. So far so good - I've had the idea! But now comes the tricky bit: resizing individual fields such that their width matches in an attractive manner. Sad to say, I'm a bit stuck here - surely there must be some function, property or method call that will allow me to spe...

vba - Word - Error in macro, trying to insert values into bookmarks

Hi, I'm trying to write a Word macro which inserts data from the Current User in Registry into predefined bookmarks in the document. I've got an ini-file which dictates what the names of each registry entry is, and that value is then imported into a loop in the Word Macro. This works fine (I think), but the Word macro needs to insert the...

How to convert .net collection type to VBA collection?

I am writing a VBA application which calls to C#.net method which returns collection object. When I assign the output to VBA.Collection I get a compile time error - Argument not optional. If I assign the output to Object I get run time error - Object variable or With block variable not set I think it is because of incompatible Collect...

Vba - On error doesn't work? Reading registry value

Hi, this is strange, I've got a macro with an array containing several registry keys. And I want to insert the values of these into predefined bookmarks in a Word document. This works great if the key is there, but if it isn't, I want the code to skip that and continue trying the next one in the array. I've got the code that looks l...

defining delimiters in vba for access

I have an interface in access that is using a barcode scanner to gather information. I would like to have a barcode that has multiple information in it example: a barcode that holds the value of an order and a specific item on that order. I have items that are divided into "lot", these items are grouped into these lots by the specific ...

How to pass an array from C# function to VBA?

How to pass an array from C# function to VBA? Can it be done? ...

What causes Error 70 in Excel VBA?

I have some code which keeps causing an Error 70: Permission Denied in my VBA code. I can't work out why, because I know that the worksheet is unprotected and that I can make changes to it. The code in question is sh.Name = "square" It attempts to rename a shape that has been copied from another sheet and pasted into the sheet - ...

Variable number of arguments in ParamArray ArgList()

If I want to pass a number of values for the ParamArray arglist via an array, how do I do it? From what I've read so far, on VBA, it appears that I need to explicitly list the values that I want to pass. But what if there are potentially different numbers of values to pass, so I do not know in advance how many I'll want to pass to the fu...

Is there a way to execute VBA code when specific tables and fields in a Microsoft Access database are updated?

I have a program that uses a Microsoft Access database for its back-end. I need to have some VBA code (that calls a web service) execute whenever specific tables/fields are updated by the program. I see this working just like a trigger in SQL Server. Is it possible to monitor for and act upon changes like this in Access? Update The pro...

Sort Excel Grouped Rows

I have a spreadsheet that has information in groups. The header row contain company names and information and then the grouped rows beneath them contain names of people in the company. Company Name | Number of Employees | Revenue | Employee Name | Email | Phone Is there anyway to sort by the number of employees and/or reve...

Compacting MDB File.

Is there any way to compact the shared mdb file. I mean this file is is always in use. I am looking for the way to compact mdb file without disconnecting users (while the mdb file is in use).... Access version is 2003. ...

Recover URL from MS Word fields showing "Error! Hyperlink reference not valid"

I have some word documents that have place holder URL's in them. The URL's are something like "http://<URL>/service.svc". Word has figured that these have to be a valid URL and when the fields get updated, replace them with "Error! Hyperlink reference not valid". When I mouse over that error text, word pop's up a tooltip still sho...

Apply Font Formatting to PowerPoint Text Programatically

I am trying to use VBA to insert some text into a PowerPoint TextRange, I use something like this: ActiveWindow.Selection.SlideRange.Shapes("rec1").TextFrame.TextRange.Text = "Hi" However, I can't figure out how to apply bold, italic and underline programatically (I don't see a .RichText property or something similar). What I have is...

Correct format for CDO AddAttachment for UNC path

CDO works fine in Access VBA for me except when I try to use UNC paths for the attachments. According to MSDN documentation on CDO, AddAttachment should allow UNC paths. Here's what I think should work, but doesn't: msg1.AddAttachment "\\serv.dom.local\path with spacesh1\file.xls" It works perfectly fine if I use "C:...". What's th...

Change the selected item in Outlook to next or previous

I rarely use VBA because I hate it. Granted, it's hate from lack of understanding; still it's hate all the same. I wrote code below that is very similar to the accepted answer here. It simply marks emails and meeting responses as read and moves them to the archive. After making a button and key assignment, it has worked very well. The p...

VBA for MS-ACCESS: how to populate a combobox with a recordset?

There is some litterature available at expert's exchange and at teck republic about using the combobox.recordset property to populate a combobox in an Access form. These controls are usually populated with a "SELECT *" string in the 'rowsource' properties of the control, referencing a table or query available on the client's side of ...

Access VBA save Report as PDF/Binary

I am using Access 2007 (VBA - adp) front end with a SQL Server 2005 Backend. I have a report that i want to save a copy as a PDF as a binary file in the SQL Server. 1, Report Opened . 2, Report Closed - Closed Event Triggered. 3, Report Saved as PDF and uploaded into SQL Server table as Binary File. Is this possible and how would i ac...

macros and IF statements

hi, i have 2 qns, hopefully simple enough for you to help me with. 1) i have 2 adjacent cells A and B. A is a validated list where it has 2 values. B should show something else that is dependent on A. my intention is to set this macro on a button and everytime the button is clicked, the 2 cells appear. 2) i have 4 cells- C, D, E. cells ...

Microsoft Access DateTime Default Now via SQL

I am writing a number of scripts to update numerous Access tables. I would like to add a column to each that has a field called "date_created" that is a timestamp of when the record is created. Doing this through the table view is simple, simply set the DefaultValue = now(). However, how would I accomplish this in sql? This is my curren...

When using range.find to find bold text it won't find if the entire selection is bold!

I'm trying to extract bold text using the range.find method and all is peachy except if the entire range is actually bold (not likely to happen much, it's more of an edge condition). With rngFindRange.Find .ClearFormatting .Font.Bold = True Do .Execute If Not .Found Then Exit Do End If 'do something with found...