Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
3 votes
1 answer
135 views

Create Table After Deleting Rows Before Desired Range and Filter to Delete All Other Unnecessary Rows

The code below first searches for the first searchText and deletes all rows that precede it to establish a range for a table object. Once the table object is ...
Bob the Builder's user avatar
6 votes
1 answer
506 views

VBA Error Handling Sub, Working for all subs

The idea is to make an error handling procedure, which prints messages in DEV mode and shows MsgBox in ...
Vityata's user avatar
  • 319
2 votes
1 answer
1k views

Part 2: Send HTTP request for each row in Excel table

This script was previously reviewed here: Send HTTP request for each row in Excel table (Part 1) I've made the changes that were suggested in the Code Review answers as well as added a few of my own. ...
User1974's user avatar
  • 198
1 vote
1 answer
63 views

Best way to avoid users to cancel my routine halfway through while managing other errors

I'm struggling to find the best way to prevent users from cancelling a routine halfway through (by pressing ESC, break, etc) without making sure the sheet is being locked again. On top of that, I also ...
MagnusNovak's user avatar
1 vote
1 answer
61 views

Clean up code that transfers data from DB2 Server to Excel

The code below is functional and works as expected, but I imagine there is a better way to test for the error that I am testing for . The scenario is that data is transferred between two different ...
Zack E's user avatar
  • 595
3 votes
0 answers
1k views

Copying content from Excel into PowerPoint as a picture, with error handling

The code below works, but I want to ask if my solution is adequate or if there's something I should structure differently. If it's alright, I'll apply the same code in other subs. My code copies ...
Alex's user avatar
  • 161
2 votes
1 answer
381 views

VBA Function Error Bubbling

What will be the best practice to create an efficient error handler in object class in VBA? Creating some for Outlook (used later in both, Excel and Access) and trying to get the most efficient and ...
Smolar's user avatar
  • 21
10 votes
1 answer
735 views

A simple ascii progress bar

I've been wanting to experiment with a bit of error handling and robustness to make my code more user friendly. I was inspired by this answer on UX to try and add a progress bar to a button - but was ...
Greedo's user avatar
  • 2,595
6 votes
1 answer
4k views

Error-Handling Class and Logging for VBA

I've been reusing an error class in Excel VBA projects for a few years now and I'd like to see if there are ways to improve it. Any suggestions for style, code, etc. are all welcome. The 2 ...
aduguid's user avatar
  • 458
3 votes
1 answer
147 views

Running SQL Queries On A Worksheet (With Set Of Random Numbers Between 1-20 Filling Column A) Handled As An ADO

INTRO I am using an Excel worksheet as my "database." No headers so [F1] is assigned to column one by default. I filled the entire column, all 1,048,576 ...
learnAsWeGo's user avatar
2 votes
1 answer
553 views

Executing arbitrary SQL statements using VBA in Excel

I built a workbook to help me extract data from a MSSQL database into Excel. I realize that this is fairly easy to do with Microsoft SQL Server Management Studio, but I can't easily get that installed ...
neelsg's user avatar
  • 173
6 votes
2 answers
170 views

Automated document downloading, with error handling

I've automated downloading of CSVs from our vendors' websites. As expected with anything web-based, things can go... wrong, so I'm implementing some better error handling. The code has been working ...
FreeMan's user avatar
  • 1,290
1 vote
1 answer
69 views

Ensuring array of worksheets are present

I have a sub which should only continue running if 4 specific worksheets are present. From online reading, such as @Tim Williams's comment in Test or check if sheet exists, I know that using an error ...
QHarr's user avatar
  • 375
9 votes
1 answer
116 views

You're logged in, except it's an error

I've automated downloading of data from a 3rd party website. The process involves logging into the site, downloading the data, then logging out - lather, rinse, repeat for each client. The code is in ...
FreeMan's user avatar
  • 1,290
2 votes
1 answer
4k views

VBA - If error return '0' else execute code

I am converting below excel formula to VBA code and it works as required. =IFERROR(IF(A2="NULL",B2*C2,A2*B2*C2),0) Could someone please review and suggest if ...
itsMe's user avatar
  • 131
5 votes
1 answer
283 views

Error handling to restart Word from Excel inside a loop

I'm often opening, from Excel, all Word documents inside a folder. And sometimes during the treatments, Word crash without throwing an error. So I've added a bit of error handling to restart Word ...
R3uK's user avatar
  • 359
3 votes
1 answer
134 views

Avoiding a call to CommandBarControl.Picture

Earlier today, I encountered an Access Violation error when opening the VBE for SolidWorks 2006, while Rubberduck VBA was initializing. I traced the Access Violation back to an attempt to set the ...
ThunderFrame's user avatar
  • 1,959
0 votes
2 answers
3k views

Check existence of item in collection [closed]

Checking whether an item exist in a collection isn't straightforward in VBA, it requires error checking and during error handling we need to clear the error and also resume code to be able to ...
Máté Juhász's user avatar
6 votes
3 answers
599 views

Parsing excel cells containing line feed characters

This is a direct follow up to Parsing cells containing Line Feed Characters. Link to sanitized xls on dropbox if test data is needed Essentially the reports I work with aren't bad - The issue is ...
Raystafarian's user avatar
  • 7,169
10 votes
3 answers
252 views

Userform for getting data from data sheet into a table

I am making a userform that grabs data from a data sheet and puts it into a table: Grabs the data based on what the user wants (Brand -> Items for brand) Allows multiple items to be added Displays ...
JED's user avatar
  • 103
7 votes
1 answer
239 views

Class: 2D Variant Array

Note: Yes. It's big. I'm not expecting commensurately long/detailed answers (though if anyone wants to write one, you'll definitely be receiving a substantial bounty). This class is going to be used ...
Kaz's user avatar
  • 8,800
6 votes
2 answers
82 views

End of day receipt emailing process

The following functions/routines are an automation of an end of day receipt emailing process that formerly would take up to an hour, but now takes less than a minute. Things to note: I changed the ...
StormsEdge's user avatar
4 votes
2 answers
4k views

Count rows of a table

I am trying to count the rows of two tables generated by SQL connections in Excel VBA. My plan was to use ListObject.DataBodyRange.Rows.Count however, this errors ...
Dan's user avatar
  • 595
4 votes
3 answers
90 views

Handling errors with minimal repetition when using Find function

I have a function that essentially searches out a value in a table by looking through the column headers and row headers to locate a data point. The function takes the sheet name, the column header ...
teepee's user avatar
  • 203
1 vote
1 answer
154 views

Code to analyse text get stuck if too much data

I've made the following VBA script to analyse text recurrence in a huge batch of descriptions. For a small part of the batch the code run smoothly, but when I include everything it tends to loose ...
R3uK's user avatar
  • 359
11 votes
4 answers
683 views

Get Workbook Method(s)

I'm re-writing my Module of standard methods. These 3 are used to retrieve Workbooks as Workbook Objects. The standard I'm aiming for here is "Third-party Library/Add-in". So: Do these functions ...
Kaz's user avatar
  • 8,800
10 votes
2 answers
387 views

Creating a pseudo Pivot Table / Database using a 4-D array

Why am I not just using a Pivot Table / Database? a) I've never ever used either before. And I don't have time to learn how before this project needs to actually be finished. b) The final output ...
Kaz's user avatar
  • 8,800
16 votes
5 answers
133k views

Try catch statement in VBA using the standard VBA error handling statements

The code below is pretty self explanatory: just copy and paste it all into a module and run it, it provides a few use cases and many explanatory comments in the text. (It works but I'm interested to ...
HarveyFrench's user avatar
10 votes
2 answers
1k views

Inline error checking in VBA

I asked a question elsewhere on Stack Exchange and was given an answer by multiple people that checking for errors in-line was not a good practice. I have been using an ...
CBRF23's user avatar
  • 409
9 votes
1 answer
939 views

Test if Excel is open without relying on catching an error

Getting a hook on an open instance of Excel is something I do all the time. I'm now questioning if I'm doing this the best way. I'm particularly concerned with the fact that I rely on the ...
RubberDuck's user avatar
  • 30.8k
12 votes
1 answer
5k views

Extending the VBA Extensibility Library

The Microsoft Visual Basic for Applications Extensibility library let's us meta-program VBA, but the way it handles (or rather, doesn't handle) getting to the actual subs and functions is clunky at ...
RubberDuck's user avatar
  • 30.8k
15 votes
2 answers
2k views

File reader/writer (text)

Following-up on this post, I wanted to be able to use my FileWriter with a syntax reminiscent of .net's using blocks, which ...
Mathieu Guindon's user avatar
9 votes
4 answers
1k views

FileWriter supporting writing to multiple files

I got bored with opening and closing files whenever I need to write to one, so I wrote a FileWriter class that's used like this: ...
Mathieu Guindon's user avatar