View Single Post
 
Old 06-07-2023, 07:27 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Looks like you already have it sorted. I will make a few minor suggestions to tidy it up a bit

1. Why redim the array if you already know how many slots
Code:
Dim arrData(287) As String
2. I'm surprised the workbook opens in the same Excel application instance but it seems a little haphazard to rely on it always being the second workbook. Is it worth exploring whether it is possible to be more explicit about which workbook is oWB?
Code:
Set oWB = oILS.OLEFormat.Object  'does this work
3. You can avoid the Select Case complexity if you make use of the worksheet function to return an empty string on errored formulas
Code:
For lngRow = 1 To lngRows
    arrData(lngRow) = WorksheetFunction.IfError(Cells(lngRow, lngCol), "")
  Next lngRow
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote