If you want to trap the error you will need to get rid of the "On Error Resume Next", you are telling the procedure to just continue regardless of what happens.
Without seeing the code you are currently using it is hard to see what may not be working for you. But this should help you in the direction.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Cancel = (Range("A1") <> 1)
If Cancel Then
MsgBox "Workbook Cannot Be...
In addition to skips' suggestion, you could also try adding Val() to your code;
If Val(shipmentListWS.Cells(ShipmentFileRowIndex, 3)) = Val(MasterListWS.Cells(MasterListRowIndex, 4).Value) Then
Which shoud return just the numeric value, which brings us full circle back to skips suggestion.
what you have posted is not too much for Excel to hold, without seeing your query or how you are putting into Excel it will be difficult to determine where the process is getting bogged down. A few things you can try though is to set Application.ScreenUpdating to False at the very beginning and...
Try adding
Application.DisplayAlerts = False
Before the line that is actually deleting the sheet and set it back after.
Application.DisplayAlerts = False
Sheets(1).Delete
Application.DisplayAlerts = True
I beleive this is what Centurion was referring to;
This is some code that we use. We have put the first part into a module
Option Explicit
Public Const REG_SZ As Long = 1
Public Const REG_DWORD As Long = 4
Public Const HKEY_CLASSES_ROOT = &H80000000
Public Const HKEY_CURRENT_USER =...
Thanks to everyone, I just figured it out it did have to do with the Propdescrip, I changed the line
objWS.Range("F" & (1 + i)).Value = PropDescrip
To
objWS.Range("F" & (1 + i)).Value = PropDescrip.Value
And it worked fine. Sorry for the trouble for what seemed to be a simple fix.
Thanks again,
Thanks Skip, that did not work either. I am a little perplexed by this, I appreciate everyones help. In the long run, it is not a big issue, I know if works from within Excel and I can make a custom menu to do it, I just was trying to get it to work from within Outlook
Here it is;
Function GetExcelWS() As Excel.Worksheet
Dim objExcel As Excel.Application
Dim objWB As Excel.Workbook
Dim objWS As Excel.Worksheet
On Error Resume Next
Set objExcel = New Excel.Application
Set objWB = objExcel.Workbooks.Add
Set GetExcelWS = objWB.Worksheets(1)
objExcel.Visible =...
Thanks VBAjedi, but no dice. Same exact thing happened at the same line with same results. Thanks though, I will keep looking at it. I have also tried using Cells() with no luck. Back at it.
Thanks.
Okay, to make it even more frustrating, I chopped up some of the original code and put it into a spreadsheet and it works fine. The below code is what I put into a spreadsheet
Sub GetTaskItems()
Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim CISTaskItems As MAPIFolder...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.