vba

SQL Server 2005 stored procedure fast in SSMS slow from VBA

I have a stored procedure which when run from SQL Server Management Studio consistently takes 5 seconds to run when called like this. exec dbo.MyStoredProc '2009-04-30 00:00:00', '2009-04-30 20:00:00' When called from an excel spreadsheet via VBA it takes 6 minutes plus (not including the time taken to copy the recordset to a sheet. ...

Removal of ¶ (pilcrow) from pasted text

Users are pasting text from Lotus Notes into my VBA application. This is then being stored in Access. Sometimes the pasted text includes what I assume is a carriage return which, when pasted into a single line form control, is displayed in the application's forms as ¶. However, as this won't paste in to the VBE, I am unable to add thi...

Legacy VBA Solutions are not working in Office 2007

Folks, An existing system that was based on VBA was installed on a machine that has Office 2007 and it didn't work, the issues I faced are : A PowerPoint Add-in (.PPA) is no longer able to create the custom buttons in the shortcut menu, did Office 2007 change the commandbar names ? The MSI (written in Wix) didn't install the files in ...

getHTTP with (excel) VBA?

Hello, I'm searching for a query for an excel VBA macro to get a webpage html code as string. I've found some source with getHTTPrequest but I can't register .net framwork system.dll or link it. any greenhorn friendly snippet out there? ;-) Thanks! ...

Selecting non-blank cells in Excel with VBA

I'm just beginning to dive into VBA and I've hit a bit of a roadblock. I have a sheet with 50+ columns, 900+ rows of data. I need to reformat about 10 of those columns and stick them in a new workbook. How do I programmatically select every non-blank cell in a column of book1, run it through some functions, and drop the results in book...

VBA Form update after values set in code instead of AfterUpdate()

I have multiple combo and option boxes whose visibility is set true or false depending on user selection of other parent option boxes. I am using the AfterUpdate() function for the parent option boxes. This method has been working fine. However when I set the values of the option boxes in VBA code (Me.MyOptionBox = 1), there is no "...

Copy worksheet macro stops doing anything when the workbook hits 50 worksheets

Hey all I have a workbook that has a number of cover sheets and then a bunch of sheets at the back that are contain a few graphs. The graph pages are created by copy-pasting one sheet ("MasterFormat") over and over again, changing a few key values each time. The macro originally used to conk out fairly rapidly with a Copy Method of Wo...

Problem getting multiple selections in a listbox to export into a worksheet

Hi there, I am new to VBA and need some help. I have created an Excel Userform with labels, textboxs, command buttons, frames, option buttons etc and they all work fine. All the data entered in the userform goes into a sheet within the excel workbook with the exception of the listbox selected data. I use the RowSource property to defi...

Loading 32bit DLL using Excel 2007 (Vista 64bit version)

I discovered that I can NOT load any 32-bit DLLs using my version of Office 2007. I’m using Vista 64bit and I assume that Office is also in 64-bit mode. Is it possible to start Excel in 32-bit mode Or Is there a way to declare a DLL using VB to load a 32-bit DLL? Since I don’t have the source code to some of the DLLs I am using, I can’t...

Hiding Text in Word (particularly tables)

Hi I've been working on a document that has a number of hidden sections that can be made visible using check boxes (and VBA). Most of this works fine including hiding Tables, Pictures, Formatting and Text using Range.Font.Hidden = True. My problem lies with leaving a table hidden, saving the document and then re-opening the document. ...

How to retrieve this computer's IP address?

What is the least cumbersome (module-inclusion, code lenght, etc) way to retrieve the machine IP address (of the first interface open)? I know of some solutions using MSINET, but I believe we can do better. Don't reply Function HomeIP() as Atring HomeIP= "127.0.0.1" End Function because it's not that funny... or correct. The scenario ...

MS Word Macro - Delete Paragraphs

Could somebody please help me with a MS Word Macro that would search for a specific symbol in every paragraph throughout the document and delete paragraphs that DO NOT contain that symbol. I know practically nothing about VBA, but just received a huge & unwieldy document I need to edit real fast. ...

How can I add a horizontal scrollbar to a VBA ListBox

I'd like to add a horizontal scrollbar to a VBA ListBox. It appears that the built in ListBox does not add a horizontal scrollbar automatically. I have a number of fields whose contents exceed the width of the ListBox and are thus unreadable to the user. I found this article, however the code fails, due to accessing hwnd of the ListBo...

Problem opening excel 2007 in new instance using VBA (using OLE and bound object frame)

Hi Guys, I have problem creating new instance of excel 2007 using VBA (from Access 2002). At first I misunderstood the problem and it is more complicated than I thought. Set myXL = CreateObject("Excel.Application") Creates new processes (I thought it didn't), but still strange thing is happening. I use OLE to store Excel files in SQ...

How to embed excel in word programmatically?

Are there any way to do so? I prefer to use VB.NET or Java and try to avoid to use VBA. Thanks! ...

Excel Determine Range

I am creating a spreadsheet which has a column of data, and I would like to calculate the varaince of x number of rows based on x inputed. Any advice? ...

Extracting VBA from a Excel spreadsheet

Is there a clean way to extract the VBA from a spreadsheet and store it in a repository. The spreadsheets hardly ever change but the VBA does. Storing the whole spreadsheet in the repository makes it difficult to do diffs across the different VBA revisions to see what code has changed and who changed it. We use VBA 6.5 / Excel 2003. ...

Access Report - Show Week Ending Date

I have an Access 2000 report based on a query like this SELECT ... FROM Clients AS wc INNER JOIN ... WHERE ((wo.OfferStatusID)=3) AND ((DatePart("ww",[wo.StatusTimeStamp]))=DatePart("ww",[Enter Week End Date])) AND ((Year([wo.StatusTimeStamp]))=Year(Date()))); The where clause allows you to enter the 'Week End Date' and it finds al...

In VBA, how to return an array / or write to cells using a function?

Using this very simple function: Function WriteArray() as Variant Dim array(0 To 2) array(0) = "A" array(1) = "B" array(2) = "C" WriteArray = array End Function I was expecting to see in result the whole array in my Excel spreadsheet, but that's not the case: I get only the first string. I know there is trick to show the whole ar...

How to add/Delete lines of code to a "ThisWorkbook" of excel file using vb.net?

As per my application I want to write some Lines code in "ThisWorkbook" of Excel file using vb.net,before that we need to check the file for existance of code. Please let me know any code or links for reference.. thank you... ...