vba

Whether to enable a security-protected feature

An Excel spreadsheet needs programmatic access to its Project structure. However, this access is disabled by default. It can be enabled programmatically, by writing to the registry with this snippet: Set wsh = CreateObject("WScript.Shell") 'key to modify' str1 = "HKEY_LOCAL_MACHINE\Software\Microsoft\Office\" & Application.Version & "...

Passing array byref doesn't edit original array

I'm trying to write a subroutine in access 2003 that removes all quote characters from strings in an array. The subroutine removes the quotes successfully in the routine itself, but not when the program returns to the passing function. I'm very confused, as it is done ByRef. How it is called: Call removeQuotes(wbs_numbers()) and the ...

How to make absolute cell ref in loop work and skipping over a column in loop?

I ALMOST got my code working but there are still two things wrong with it (two major things anyway). 1) The absolute cell ref. is not working as it does in Excel. I want for example $A5 but instead of changing to A6 A7 etc., it stays A5 throughout the loop. 2) There is a third column that I need to skip over. I only need my loop to wri...

MS Access 2000 - VBA Value from a combo/text box into a file path string

Hey guys. I have a form that I intend to allow users to browse powerpoint presentations through, because there are a lot of different briefs for metrics, which is what I use this database for. So, I already know how to set up everything, just got one little hang up. If I place a combo box on the form to select from a list of different p...

How could i get the full path name of running word or power point file by VB or VBA

I need to copy file from pen drive which file is running from pen drive. This soft must be running in background. Pls, Send me the code of getting running office pile path......... ...

VBA text box input mask

I have two validation for date and time as below in text boxes: 00/00\ 00:00;0;0;_ It will take (dd/mm hh:mm) and works fine But sometimes i put 34/34 56:78 it will take , But it shouldn't Date sholdnot go beyond 31, month 12 time 24 and minute 59 Please help ...

Validation Problem in vba text box

I want to validate a text box where the user enters the date in format dd/mm and time hh/mm in the same text box how to do this? ...

VBA point variable to range

Hi I want to point to a cell as a range in VBA. I've tried using: Dim range range = Sheet("sheet").Range("A1") But this just returns the value in the range. What I actually want is the range object so I can manipulate it, e.g. by setting range.Value = "Hello" Any ideas? ...

Sending an Email from MS Access No third party dll allowed

I need to send a series of email notifications from an MS Access Database. No third party dll's like Redemption Cannot trip the outlook security warnings The email will have a pdf attachment I know to do this I need to use MAPI, but I can't seem to find a way to do this with VBA. Any help would be appreciated Thanks, Scott ...

Where can I find documentation for Excel's Pictures collection?

I have seen many references to doing something like the following to insert a picture in Excel: Set p = ActiveSheet.Pictures.Insert(PathToPicture) Where can I find the canonical documentation for this? ...

Close currently opened MsgBox using code

Is there any option to close the currently opened MsgBox using any code in VBA access form application ? \ ...

How do I force VBA/Access to require variables to be defined?

I'm making some significant changes to some VBA code, and some variables are being deleted and/or renamed. It would be a lot easier to find all the locations I need to update if the compiler would complain to me that the variables don't exist instead of creating it on the fly. ...

KeyUp event of one button navigating to Enter event of other button

Hello, I have a keyUp event in button1 and EnterEvent in button2 When i press button1 and use my up arrow automatically control is navigating to Enter Event of button2 after entering into the KeyUp event of button1 Feels something fishy; Please help !! ...

Re-Initializing "ThisWorkbook.Path"

First, thanks to those of you who gave me the suggestion on using "ThisWorkbook.Path". It worked like a charm. However, my code walks through seven (7) workbooks and when using "ThisWorkbook.Path" I can not re-initialize the "This.Workbook". Let me elaborate. This is the workbook where the Macro resides: Workbooks("Financial_Aggrega...

Assigning number value to a variable in VBA

I need to assign a number value to a variable in VBA. I did this: var num as integer num=1 but when I put a breakpoint at num=1 and see the value of num it's showing 0 (zero). Please help. ...

MS Access - How to turn a Dataset/query table into an OLE Object? msAcess 2000

I have some VB that copies OLEobjects into powerpoint automatically for me. The purpose of this is that my database runs queries, and then forms turn them into charts. As it runs through the various queires/form on open/close events the charts are added to a powerpoint presentation. I also have parallel queries that show the resulting d...

Why don't DIMs reformat in MS Access.

Is this another MS Access 2000(2007)-ism? If I type the following: foo = blah + blah - bar the editor automatically reformats it as foo = blah + blah - bar But I type: Dim foobar as long the editor doesn't reformat it at all. Some how I expect it to reformat it to Dim foobar as long Did it always work this way (I ha...

Why is my query demanding more fields in my Group By?

Problem: I originally had a query that was working great but I'm now having to change it to pull more fields. When I try run the new query it picks a field name and says that I haven't included it as part of the aggregate function. Each time I get this error I can add the field the error specifies to the Group By statement and the error ...

What does it mean? expr1 = expr2 Mod expr3 = 0

So I am porting a VBA application to PHP and ran into this wonderful little nugget of code: expr1 = expr2 Mod expr3 = 0 I thought it was behaving like a ternary operator but when I broke it down to simple if then statements the outcome was not as expected. So I ask the brilliant stack**overflow** community to help me out and put it in...

Rookie MS Access - Creating the Front End MDE

ok guys. here are some rookie questions for you: I created a database for tracking metrics, with some automation tricks (email, .doc,.ppt presentations, etc) with a very large Main-table, and lots of forms/GUI. This is the first time I have ever I worried about an MDE/front-end for the thing. So if you would be so kind to answer a few q...