vba

No Environ("password") for Active Directory User Binding?

I want to reuse the Windows authentication to bind to the Active Directory user and check group membership. I can get the Windows username with Environ("username"), but how do I get the password? I don't want to have to require the user to reenter their password, but there is no Environ("password"). How do I make this code work? Thank...

How do i copy rows from one worksheet and then delete them after it has moved?

hi, How do i copy rows from one worksheet programatically using VBA and then delete them after it has moved? I don't seem to be deleting all records based on the criteria, i'm searching for. Dim lRowCounter as Long, lTotalRows as Long,sCommPerUnit as String,lExceptionRowCounter as Long lTotalRows = 10 For lRowCounter = 1 To lTotalR...

How to copy just one sheet (not all) to .xls file in Excel VBA?

Please Help. I want to copy just one Sheet ‘MainFinal’ among twelve other sheets(not all of the sheets in the original), to another .xls file using Excel VBA . The code I have attached below works , except it copies all worksheets and not JUST the one, and also when new file created it opens and source file is closed . Anyone have any ...

Redimming arrays in VBA

I have 3 arrays of data, that are filled by reading off of an excel sheet, some of the points of data are missing and as such have just been entered into excel as "NA" so I want to look through my array and find each instance of these NA's and remove them from the array since the information is useless. I need to update all three arrays ...

How to make function to call only when input parameters are change

Hi, I'm creating set of user defined functions, but I only need to recall these function if and only a input parameter of a partcular function is change. Currently, even I delete/insert a row the function are being called, How can I stop this function recalling ? Thank You ...

My MS Access control displays no text for appended items following an append query

Relevant Tables #One# +----------+ +--------------+ |Quotations| ---> |PurchaseOrders| +----------+ | +--------------+ <One> | <Many> | | v #Many# | +-----------+ +------------+ v |Quot...

Export Visio Macros to Visio COM-Add-in

Hi all, I have written some Makros and Functions in VB all code works fine behind my Document. To save my code and make it available to other users I want to create a COM-add-in for VIsio. So i bought Visual Studio 2008 and I want to import my code to it. Is it possible to include my exported .cls file to my Visual Studio COM-Add-on Pr...

Run VBA macro when condition is met

Hello all, I'm creating a spreadsheet to train my numerical skills. Now, I use VBA macros to generate a new problem once the current one has been correctly solved. To do so, I still have to press a button in the worksheet, which costs time and is annoying. Is there a way that I can execute a macro when a certain condition is met? f...

Fixed number of rows In Access Report

Hello All, I am having tried a access 2007 report with fixed numbers of rows (records) per page. For example, I like to fix total number of records (rows) to 10 per page while underlying query might have 5 records in some criteria or 15 records in some case. If any idea, please share me. TIA ProNek ...

Sort Outlook Inbox "Arrange By" | Switch between FROM and Conversation View

Using VBA and a toolbar button, I'd like to be able to Switch between FROM and Conversation View, but I just can't work how to or find the code to do this. I tried the Sort Methods but, they only work in memory and don't re-sort the actual inbox. I use Conversation View for GMail style functionality with my Sent items BCC'd to myself, ...

How do I write to a command prompt that is already open?

I need to write one line at a time (user iterative process) to a command prompt that is already open. I'd like to use VB or VBA. I know there is AppActivate, but then how do you write to it? The command prompt is run by another program (that I can't touch). Suggestions? ...

Use system tray & icons in VBA (Access)

I've found a few tutorials that explain how to use the windows API to get a custom icon in the system tray. These are all for Visual Basic, and they don't seem to be scaling to VBA well. I'm following this short tutorial: http://atchoo.org/vb/systray.php Basically, you have to set the hIcon value (a 'long' variable) but it does not wo...

Help with function in string

I have a variable, emailBody, which is set to a string stored in a database. The email body is set to a string via a dlookup function. emailBody = DLookup("emailBody", "listAdditions", "Id = " & itemType) The string that email body is set to includes an IIf function (which includes a dlookup function). When ?emailBody is entered in...

need to replace an image inside word-document with an excel chart

is there any simple way to replace an image inside word-document with an excel chart using VB and preserving all of the format details such as image frame style, text wrap, anchor, etc. (thus the image is just a placeholder in a template document) ...

SQL UNION ALL problem with adjacent columns

I'm getting a formatting problem when I use UNION ALL under Excel 2007. I have 12 worksheets one for each month I'm trying to apply UNION ALL to combine all the data from these 12 worksheets. Each worksheet has 3 columns 2 with numerical data and one with date. I've had the problem with the last worksheet. My numeric column turns into st...

Is there a way to evaluate a variable in vba?

I have a variable newItem. I want to place the value stored in newItem into a string. I thought I would be able to accomplish this with... myString = eval(newItem) ...but it doesn't work. Is there any way to evaluate a variable in Access vba? ...

How can I bold the font in Lotus notes when generating an email from Access 2003?

I am running Access 2003 and have created a module which sends an email to recipients from the database in Lotus Notes. It works just fine, but now I have been asked to "Bold" specific text in the email so that it is easier to read on their blackberries . Can anyone help me format the text? I'm not sure how to do this.... Here is the cod...

How to load single COM instance for multiple application instance

Hi, I'm creating a COM dll and it will be loaded by VBA. However, I noticed that for every excel instance (workbook), a new COM object is loading to memory. But I need to maintain single COM state irrespective of number of Excel instances exists. Please help me achieve this purpose . Thank you ...

The host 'smtp' could not be found.

I am getting the following error while sending mail by click of a button in MS access form I am using sendObject to send mail using vba code. The host 'smtp' could not be found. Please verify that you have entered the server name correctly. Account: 'pop3', Server: 'smtp', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket ...

VBA ActiveX controls grow in size over Remote Desktop Connection

We have an Excel workbook with a number of ActiveX controls, running in Excel 2003 on Windows XP. When connecting using Remote Desktop, the ActiveX controls change font, sometimes font size, and sometimes orientation (in the case of a spinner control). This happens on first connection and also as the workbook is used - some of the cont...