vba

Is object clearing/array deallocation really necessary in VB6/VBA (Pros/Cons?)

Hello, A lot of what I have learned about VB I learned from using Static Code Analysis (Particularly Aivosto's Project Analyzer). And one one of things it checks for is whether or not you cleared all objects and arrays. I used to just do this blindly because PA said so. But now that I know a little bit more about the way VB releases res...

Visual Studio 2008 Macro for Building does not block thread

Hello, I am trying to write a macro for Building my application, kicking off an external tool, and ataching the debugger to that external tool. Everything is working except for the building. It builds, but it is not blocking the thread so the external tool gets kicked off before it can finish. Is there a way I can run ExecuteCommand an...

VB Excel: How to move Worksheet with Forms/Macros

Hello again. I'm having a problem transferring a worksheet into another workbook. I've written several macros in my first workbook, as well as 1 or 2 forms, and I need to be able to move this worksheet that contains these macros and forms into a new workbook. If I just do a simple worksheet copy, the new version of the worksheet will ...

Excel VBA "Autofill Method of Range Class Failed"

The following VBA code (Excel 2007) is failing with Error 1004, "Autofill Method of Range Class Failed.". Can anyone tell me how to fix it? Dim src As Range, out As Range, wks As Worksheet Set wks = Me Set out = wks.Range("B:U") Set src = wks.Range("A6") src.AutoFill Destination:=out (note: I have Googled, etc. for this. It comes u...

Can I get the user name and server for the currently logged in Cisco VPN session?

Is there a way to get the user name and server from Cisco VPN for the currently logged in session using VBA? According to Cisco documentation, there is an API that can be used to retrieve attributes such as VPN_STATE_CONNECTED and VPN_AUTH_USERNAME, but I don't know how to hook into it from within a VBA add-in for Microsoft Office Excel...

MS Access 2003 - Sparkline Graphs in Microsoft Access

Hey guys. Just wondering if anyone knows of a method to create sparkline graphs on a form in MS Access. The chart builder does not really work very well to create sparkline charts (graphs that small). Just curious, thanks! ...

Parsing Outlook calendars for an in/out calendar

I've written some VBA which generates an HTML based in/out calendar for all the members of my team. Because I need to get the status of people for the whole year and details of their appointments I've avoided using the FreeBusy information and instead opted to open each users calendar, extract all the appointments and work out which days...

find formula in excel

is it possible to search for a certain text using =find(...... within a specific column like: C1:C2577 ...

Reports as PDF in Access 2007 using a Stored Procedure

I am creating a report in Access 2007 and am able to save it as a PDF, but the problem is that instead of having 1 report per PDF I have got 206 Reports in 1 PDF. I'm using VBA to programatically do this here is the code I'm using Sub makeLetterPDF(Contract As String, LetterType, outTo As String) Dim rs As New ADODB.Recordset Dim strR...

to modify a query in access

Hi, I have a query which gives a result like this field1 field2 field3 field4 field5 23 gfhf ghjj 5 49 23 ghf jkll 6 45 67 bnvn nmb 7 45 89 gfh hjj 8 78 89 gfhg hk 9 23 Here the first 2 and last 2 records are kind of sa...

Lock Excel Document after a certain Date

How can I cripple an excel document after a certain date? I want it to become unusable after, say, 12/31/2009. I was thinking about putting one of those Must Enable Macros things in there that hides all the sheets on close and leaves one tab that says you must enable macros. Then having an on open macro that unhides all those tabs, bu...

Dictionary Property in VBA Class

I have been asked to modify an Excel sheet with some arcaic programming. I have decided to rewrite it rather then modify all of the many GOTO statments and static arrays. My background is in C# so it has been a bit of a challenge (note: I am sure the naming convention is bad, I am used to being able to use underscore to define private ...

Hide the EPS conversion dialogue in Word

I have some vba code which inserts a picture into Word , the source file is an EPS. Word automatically displays a progress dialogue when it's converting the image. Is there anyway to hide this dialogue (using vba)? Thanks Chris ...

Documentation Resource for Office VBA developers

Where do I find helpful documentation for VBA programming? something like SitePoint for HTML development. MSDN simply lists down and describes the operation and properties/methods of classes instead of explaining what they are used for, or when to use them. Books are also welcome. ...

How to pause for specific amount of time?

I have an Excel worksheet that has the following macro. I'd like to loop it every second but danged if I can find the function to do that. Isn't it possible? Sub Macro1() ' ' Macro1 Macro ' Do Calculate 'Here I want to wait for one second Loop End Sub Thanks. ...

Array from Range in Excel VBA

Well I've been struggling with the little bit of code and can't seem to get around it ... I'm trying to get an array from a range of cells, the array however is showing up to be 1 element wide. Well here's the code: Dim item As Variant MsgBox Range("D19:H19").Count item = Range("D19:H19").Value MsgBox LBound(item) & " " & UBound(i...

Excel macro doesn't update correctly

Hi i have created macro for excel but it seems somewhere i have done something wrong, i want to fetch an image from a URL and then update it up to 1 second (more or less) Sub GetPicture() PictureURL = "This is where i put the URLi want" Set MyPict = ActiveSheet.Pictures.Insert(PictureURL) Cells(1).Value = Now nextTime = Now + TimeV...

Visual Basic (for Applications) Learning Resources

As resident techie I have been charged with teaching some colleagues VB specifically for use with Excel. My main duties involve MySQL and Objective-C and haven't touched VB since University. While I'm not worried about the prospect of learning VB (how hard can it be, right?). I have no clue on where to point my "students" to start. Any...

BeforeUpdate problem - Runtime error 2115

I have written the following query : Private Sub Size_Sqft_BeforeUpdate(Cancel As Integer) Me!Size_Sqft = Nz(Me!Size_Sqft, 0) End Sub But while i removing the zero in the filed to make it null , i am getting the following error Runtime error 2115 Macro and function set to before update and validation rule property for this field...

Calling a DLL from VBA

I need to call a DLL function from Access using VBA. The prototype for the DLL function is int __stdcall myFunction(const char* data, int rows, int cols, int sl, int fullsize, double aspect_ratio, double y, void** ppResult); The one I declared in Access: Private Declare Function DllImport_myFunction _ Lib...