Equivalent to Application.EnableEvents = False in VBA
With Visual Basic 2013 is there an equivalent statement to the VBA "Application.EnableEvents = True/False"? I am loading a saved information file into a form and I want to temporarily turn off event checking (so the changes in the
many text boxes don't trigger the event handlers for each of them) until the form is loaded, then turn it back on. I looked at "AddHandler" and "RemoveHandler" but these require doing it for each text box individually. (ugh!)
Another example
Option Strict On
Public Class Form1
WithEvents TBox As TextBox
Dim GroupBox1 As New GroupBox
Dim MyTextBoxs As New List(Of TextBox)
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Size = New Size(600, 600)
Me.Location = New Point(CInt((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Me.Width / 2)), CInt((Screen.PrimaryScreen.WorkingArea.Height / 2) - (Me.Height / 2)))
With GroupBox1
.Name = "GroupBox1"
.Font = New Font("Book Antiqua", 11)
.Height = 520
.Width = 240
.Left = CInt(Me.ClientRectangle.Width / 2)
.Top = 20
.FlatStyle = FlatStyle.System
.Text = "GroupBox1"
End With
Me.Controls.Add(GroupBox1)
Dim x As Integer = 20
Dim y As Integer = 80
For i = 1 To 10
TBox = New TextBox
With TBox
.Name = "TextBox" & i.ToString
.Width = 200
.Height = 50
.Font = New Font("Cambria", 11)
.Location = New Point(x, y)
.Multiline = False
End With
If i < 6 Then
Me.Controls.Add(TBox)
Else
GroupBox1.Controls.Add(TBox)
End If
y += 60
If y >= 330 Then y = 80
Next
For Each Item As Control In Me.Controls
If Item.Name.Contains("TextBox") Then
MyTextBoxs.Add(CType(Item, TextBox))
End If
GetAllChildControlsForMyTextBoxs(Item)
Next
End Sub
Private Sub GetAllChildControlsForMyTextBoxs(ByVal ctrlParent As Control)
For Each Item As Control In ctrlParent.Controls
If Item.Name.Contains("TextBox") Then
MyTextBoxs.Add(CType(Item, TextBox))
End If
If Item.HasChildren Then
GetAllChildControlsForMyTextBoxs(Item)
End If
Next
End Sub
Private Sub TBoxs_TextChanged(sender As Object, e As EventArgs)
Select Case DirectCast(sender, TextBox).Name.ToString
Case "TextBox1"
MessageBox.Show("TextBox1's text changed.")
Case "TextBox7"
MessageBox.Show("TextBox7's text changed.")
End Select
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Button1.Text = "AddHandler List" Then
Button1.Text = "RemoveHandler List"
For Each Item In MyTextBoxs
Try
AddHandler Item.TextChanged, AddressOf TBoxs_TextChanged
Catch ex As Exception
End Try
Next
Else
Button1.Text = "AddHandler List"
For Each Item In MyTextBoxs
Try
RemoveHandler Item.TextChanged, AddressOf TBoxs_TextChanged
Catch ex As Exception
End Try
Next
End If
End Sub
Dim AddIt As Boolean = False
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If Button2.Text = "AddHandler Recursion" Then
AddIt = True
Button2.Text = "RemoveHandler Recursion"
For Each Item As Control In Me.Controls
If Item.Name.Contains("TextBox") Then
Try
AddHandler Item.TextChanged, AddressOf TBoxs_TextChanged
Catch ex As Exception
End Try
End If
GetAllChildControls(Item)
Next
AddIt = False
Else
AddIt = False
Button2.Text = "AddHandler Recursion"
For Each Item As Control In Me.Controls
If Item.Name.Contains("TextBox") Then
Try
RemoveHandler Item.TextChanged, AddressOf TBoxs_TextChanged
Catch ex As Exception
End Try
End If
GetAllChildControls(Item)
Next
AddIt = True
End If
End Sub
Private Sub GetAllChildControls(ByVal ctrlParent As Control)
For Each Item As Control In ctrlParent.Controls
If Item.Name.Contains("TextBox") Then
If AddIt = True Then
Try
AddHandler Item.TextChanged, AddressOf TBoxs_TextChanged
Catch ex As Exception
End Try
Else
Try
RemoveHandler Item.TextChanged, AddressOf TBoxs_TextChanged
Catch ex As Exception
End Try
End If
End If
If Item.HasChildren Then
GetAllChildControls(Item)
End If
Next
End Sub
End Class
La vida loca
Similar Messages
-
Detect pdf application: if false jump to marker
I am still a beginner with director. I am using buddy api,
and I am looking for a script that will check to see if a pdf
reading application is installed, if it is not I need to jump to a
specific marker, which contains a menu informing the user they need
to install adobe reader, which I have set up a link to do. Any help
would be appreciatedEL_devin wrote:
> I am still a beginner with director. I am using buddy
api, and I am
> looking for a script that will check to see if a pdf
reading
> application is installed, if it is not I need to jump to
a specific
> marker, which contains a menu informing the user they
need to install
> adobe reader, which I have set up a link to do. Any help
would be
> appreciated
if baFindApp("pdf")="" then
-- no associated app
end if
or on a Mac:-
if baFindApp("CARO")="" then
-- no associated app
end if
Andrew -
VBA code not working in SEM-BPS 3.2
We are currently running on BW 3.1 and SEM-BPS 3.2 environment. I am trying to create a screen in excel with VBA code doing validation on user input. For some reason the code works perfectly fine in standalone Excel. But when it comes to BPS, the code does not work. Is there any setting to invoke the code? Any help would be greatly appreciated.
ThanksBindu,
Thanks for your reply. I checked in the layout builder and both the VBA Macro - SAPAfterDataPut and SAPBeforeDataGet are checked. Below is the code:
Thanks again!
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("D1:D1000")) Is Nothing Then
If Target.Value = "183998" Or Target.Value = "192999" Or Target.Value = "0000183998" Then
ActiveSheet.Unprotect
On Error Resume Next
'Application.EnableEvents = False
MsgBox "You cannot plan on TPIs 0000183998 Or 0000192999"
Target.ClearContents
'Application.EnableEvents = True
ActiveSheet.Protect
End If
End If
End Sub -
STATIC TIME STAMP IN MULTIPLE COLUMNS
I have a single spreadsheet for Monday - Friday. There are multiple columns for each day. It has been asked of me the following:
When the customer name is typed for the first time in columns: E, T, AH, AV, BJ rows 5-28 then the static date & time would appear in another column on the same row. I would be adding columns (M, AB, AQ, BF, BU) for date/time.
Example: Customer name typed in E5 the date time would show in M5 for Monday. For Tuesday, it would be T5 with date in AB5, etc.
I have very little experience with VBA and have searched the internet for a solution, there are many conditions and have tried for using solutions for just one column, but none have worked.
Thank you
Linda
woodlindaYou can have only one Worksheet_Change event procedures per worksheet. You have to combine the two Worksheet_Change event procedure into one:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Columns("C:BB")) Is Nothing Then
Rows(Target.Row + 1).Hidden = False
End If
If Not Intersect(Range("E5:E28,T5:T28,AH5:AH28,AV5:AV28,BJ5:BJ28"), _
Target) Is Nothing Then
Application.EnableEvents = False
Intersect(Range("E5:E28,T5:T28,AH5:AH28,AV5:AV28,BJ5:BJ28"), _
Target).Offset(0, 8) = Now
Application.EnableEvents = True
End If
End Sub
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
How to disable Multi-selection thing in slicer.
Hello,
I am using Slicer in Excel Sheet and i want to disable Multi-selection thing in slicer.
Is it possible to throw an exception or doesn't allow to do a multiple selection in excel slicer using VBA or without?
Quick help ll be appreciated :)
Thanks & regards,
Gaurav Badhani.Thanks for your reply,
I used below given code and it's working and i put this code on ThisWorkbook and calling on
Workbook_SheetCalculate
Workbook_SheetSelectionChange
it's working fine but whenever i am selecting slicer value using CTRL key this code is not excuting coz system is not able to call events
Kindly help me with the events or code coz i am using CTRL key for multi selection and whenever i am using CLRL key it's not working
Please find below given code
Dim scl As SlicerCacheLevel
Dim oSlicer As Slicer
Dim i As SlicerCaches
Set i = ActiveWorkbook.SlicerCaches
Dim oSi As SlicerItem
Dim ItemsAllowed As Integer
Dim cntItems As Integer
ItemsAllowed = 1
cntItems = 0
Application.EnableEvents = False
For Each oSi In ActiveWorkbook.SlicerCaches("Slicer_RC_Description").SlicerItems
If oSi.Selected Then cntItems = cntItems + 1
If cntItems > ItemsAllowed And oSi.Selected Then
oSi.Selected = False
MsgBox "Please select only one item"
Application.EnableEvents = True
Exit Sub
End If
Next oSi
Also tell me what event i should use for ur code or how can i use code using CTRL key
Thanks & Regards,
Gaurav Badhani
A -
Bex Analyzer 7.0 - BexEventHandler in Netweaver 2004s
Hi, I noticed that in Bex Analyzer 7.0, there is a new class called BexEventHandler which gets hit each time I select a cell or a worksheet within my VBA code. This did not happen in Analyzer 3.5. And because of this, I am experiencing major performance issue in my macro.
I have a workbook that contains 10 queries (10 worksheets) and a VBA code that merges all the data from the queries into 1 single worksheet. Upon conversion to 7.0, my code is now running extremely slow as it is always going to the BExEventHandler class at each cell.select or sheet.select.
Does anyone know how to bypass this BexEventhandler in Bex Analyser 7.0??
Would appreciate any feedback you can provide.
Thanks,
SheilaHi, I found the command in VBA that does disables the Bex event handler code.
Application.EnableEvents = False
Set this to false before your code starts and set it to true again after your code. -
CDR origIpAddr to a readable format in excel
Hi Guys,
Has anyone found a formula in excel to convert the origIpAddr in the CRD files in to a readable ip address.
I have found this
Step 1 Convert the database display (-1139627840) to a hex value.
The hex value equals 0xBC12A8C0.
Step 2 Reverse the order of the hex bytes, as shown below:
CO A8 12 BC
Step 3 Convert the four bytes from hex to decimal, as shown below:
192 168 18 188
Step 4 The IP address displays in the dotted decimal format:
192.168.18.188
From this doc http://www.cisco.com/en/US/docs/voice_ip_comm/cucm/service/7_0_1/cdr-defs/cdrcallinfo.html#wpmkr1079974
But am hoping someone has created a formula to get around this.Hey guys:
Working with Excel Macros in VBA I finally solved the issue with the combination of the next functions, hope this helps
Using the DEC2HEX command we obtain an HEX number which we have to reverse, so I used the next function to reverse the string:
Function ReverseText(rt As Range)
Application.Volatile
Dim iLength As Integer
Dim iCount As Integer
Dim ipCount As Integer
Dim LValue As String
iLength = Len(rt)
ReverseText = ""
If iLength = 7 Then ' Validate if we have an Hex number in the type 0xXXXXXXX
LValue = "0" & rt.Value ' Concatenate a 0 to have an 8 digit Hex number
iLength = Len(LValue) ' Recalculate the length to have the 8 Hex digit number
Else
LValue = rt.Value
End If
For iCount = iLength To 1 Step -2
If ipCount < 4 Then
ReverseText = ReverseText & _
Mid(LValue, iCount - 1, 2)
ipCount = ipCount + 1
Else
iCount = 1
End If
Next iCount
End Function
After we have the reversed HEX number, I used this next function to normalize the IP address into an standard IPv4 text:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
Application.EnableEvents = False
For Each Cell In Target
If Not Intersect(Target, [IPAddresses]) Is Nothing Then
If Len(Cell) > 0 Then Cell = GetNormalizedIPAddress(Cell)
End If
Next Cell
Application.EnableEvents = True
End Sub
Public Function GetNormalizedIPAddress( _
ByVal Text As String, _
Optional ByVal ZeroPadOctets As Long = 0 _
) As String
' Convert text to IP address. Text can be any value or an eight character
' hexidecimal number. Examples:
' 0 -> 0.0.0.0
' 255.10 -> 255.10.0.0
' FFFE0001 -> 255.254.0.1
' 258.-1.0.0 -> 255.0.0.0
' Use the parameter ZeroPadOctets to pad each octet with zeroes. Pass a
' positive integer from 1 to 4 to pad that number of octets starting from
' the left. Pass a negative integer from -1 to -4 to pad that number of
' octets starting from the right.
Dim Nodes As Variant
Dim Index As Long
Dim Result As String
If Len(Text) > 0 Then
Nodes = Split(Text, ".")
If UBound(Nodes) = 0 And Len(Nodes(0)) = 8 Then
ReDim Nodes(0 To 3)
For Index = 0 To 3
Nodes(Index) = CStr(CLng("&H" & Mid(Text, Index * 2 + 1, 2)))
Next Index
End If
For Index = 0 To UBound(Nodes)
If Not IsNumeric(Nodes(Index)) Then Nodes(Index) = 0
Nodes(Index) = Application.Max(0, Application.Min(255, Nodes(Index)))
Next Index
Result = Join(Nodes, ".") & Left(".0.0.0", 6 - UBound(Nodes) * 2)
Nodes = Split(Result, ".")
If ZeroPadOctets > 0 Then
For Index = 0 To 3
If Index + 1 <= ZeroPadOctets Then Nodes(Index) = Right("00" & Nodes(Index), 3)
Next Index
Else
For Index = 0 To 3
If 4 - Index <= -ZeroPadOctets Then Nodes(Index) = Right("00" & Nodes(Index), 3)
Next Index
End If
GetNormalizedIPAddress = Join(Nodes, ".")
End If
End Function
And its done.
Best Regards
Ing. Allan O. Mancera
CCVP -
Hi there,
I have two columns, let's call them Event Date (Column A) and Previous Event Date (Column B).
I would like to implement some <acronym title="visual basic for applications">VBA</acronym> code (or use formulas if necessary) that automatically keeps the previous value of Event Date and retains it in the adjacent cell for Previous
Event Date.
For example, if A3 = Jan-03 and I update A3 to Jan-04, B3 would then show Jan-03 as it is the previous value of the cell.
I would like this code to work for a whole column of cells, not just a single cell.
I'm open to any & all ideas and appreciate the help. If any clarifications are necessary, just let me know.Right-click the sheet tab.
Select View Code from the context menu.
Copy the following code into the worksheet module:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim newVal As Variant
' Code won't work if multiple cells have been changed
If Target.Count > 1 Then
Exit Sub
End If
' Only act if cell in column A has been changed
If Intersect(Range("A:A"), Target) Is Nothing Then
Exit Sub
End If
' Turn off events and screen updating
Application.EnableEvents = False
Application.ScreenUpdating = False
' Get new value
newVal = Target.Value
' Undo to restore old value
Application.Undo
' Copy old value to adjacent cell
Target.Offset(0, 1).Value = Target.Value
' Redo the change
Target.Value = newVal
' Turn on screen updating and events
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
Remarks:
If you change multiple cells at once, the code won't do anything.
When you change a cell in column A, that cell will remain the active cell, i.e. Tab or Enter won't activate another cell.
When you change a cell in column A, Undo will be disabled.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
Event "Workbook_BeforePrint" not on new funtion "preview&print"
Hi
After starting the work with Excel 2010 I recognized that the new function "print&preview" does not call the event "Workbook_BeforePrint" from the VBA code. In Excel 2007 the event is called on both functions, print and preview.
As the new function "preview&print" is pushed to the user, it will the one to be used to call the preview. But with a macro on the event "Workbook_BeforePrint" the preview will not show the result as it will be printed.
Is there any action I can take to solve this problem on my side? Or is there any plan to integrate the event into the new function?
Many thanks for every help.Hello Parzungjh,
Welcome to the MSDN forum and we are glad to help with you.
After reading your post, I did test in Excel2010 and Excel2007, just as you said, I reproduce your problem. However, I don't think
it as a problem.
I think it is by design.
I found that print and preview feature is integrated in Excel2010. If you want to control the trigger of BeforePrint event
in Excel2010, you can write some simple VBA codes as follows:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Print_or_Preview As XlYesNoGuess
Application.EnableEvents = False
Cancel = True
Print_or_Preview = MsgBox("Show Print Preview?", vbYesNo)
If Print_or_Preview = vbYes Then
ActiveWindow.ActiveSheet.PrintPreview
Else
ActiveWindow.ActiveSheet.PrintOut
End If
Application.EnableEvents = True
End Sub
ActiveWindow.ActiveSheet.PrintPreview
can open the print preview dialog like Excel2007. I haven't found the way to open the print view dialog through UI.
I think it is the change in Excel2010.
I hope it can help you and feel free to follow up after you have tried.
Best Regards,
Bruce Song [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Adding HTML inside a cell with PDV
Hi all,
I got a small problem here: I need to add some HTML code around the data in a PDV cell. The PDV is rendered using a JCO.Table.
Within the beforePdvExecuteSource(IDataViewer) there are already some methods which change the content of a field but there it's always about adding a link into the field which can be done with IFieldInfoItem.setDisplayType(TableColumnType.LINK).
Any ideas how to do so?
thx,
Paul
P.S. simply adding it as string would result in s.t. like <b>test</b>
P.P.S. where can I find the javadoc of com.sapportals.* ?Right click the worksheet tab name and select View code to open the VBA editor
Copy the code below and paste into the VBA editor.
Edit the line with the comment to the required range where you have the "w" and where the scanned codes are to go.
Close the VBA editor (Cross with red background top right)
Save the workbook as Macro Enabled workbook.
Ensure Macros are enabled in options. See Help fot how to do this. Option to "Disable all with notification" should be ok.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim varNewVal As Variant
On Error GoTo ReEnableEvents
'Following line edit "A:A" to the required range
If Intersect(Target, Range("A:A")) Is Nothing Then GoTo ReEnableEvents
Application.EnableEvents = False
varNewVal = Target.Value 'Save the new value in the cell
Application.Undo 'Revert to the previous value in the cell
If UCase(Target.Value) = "W" Then 'Test if previous value was W
Target.Value = Target.Value & varNewVal 'Concatenate the previous value and new value
End If
ReEnableEvents:
If Err.Number <> 0 Then
MsgBox "Error occurred in worksheet module Private Sub Worksheet_Change"
End If
Application.EnableEvents = True
End Sub
Regards, OssieMac -
Opening a password to modified file...
Hi
I want to use VBA code to check if a file has a 'password to modify'.
I think there are 2 parts to this:
Opening the file without having to see the dialog box prompting me to enter the password (I've set
Application.EnableEvents = False
Application.DisplayAlerts = False
but they don't seem to help)
Then once in is there a way of checking that that it has a password?
Many thanks
James
Andrew BinnzMaybe something like this:
Sub Main()
Dim wb As Excel.Workbook
Application.DisplayAlerts = False
On Error Resume Next
Set wb = Workbooks.Open("C:\Users\Felipe\Desktop\Pasta1.xlsx", , True)
On Error GoTo 0
If wb.WritePassword <> "" Then
MsgBox "Has Write Password."
End If
End Sub
Felipe Costa Gualberto - http://www.ambienteoffice.com.br -
Refresh Hidden Sheet data for Chart
Hello people, I'm trying to expand a hidden sheet data to refresh a chart using these data, (in BPC 10 nw sp 17 patch 2)
The problem is that Data sheet is not refreshed, don't know the reason. Maybe someone can help me.
If I unhide the data sheet, and refresh it using standard refresh buton, it works. But I want to hide data sheet.
I remember doing this with EVDRE in BPC 7 and the procesdure was more or less the same:
Disable events/ screenupdating -> Unhide Data Sheet -> refresh -> Hide Data sheet -> Enable events/ screenupdating
Here is the VBA function I'm using:
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim EPMOB As EPMAddInAutomation
Set EPMOB = New EPMAddInAutomation
Sheets("Chart Data").Visible = True
ActiveWorkbook.Sheets("Chart Data").Select
EPMOB.RefreshActiveSheet
Sheets("Chart Data").Visible = False
Sheets("Chart").Select
Application.EnableEvents = True
Application.ScreenUpdating = True
Thanks for your help.Hi Vadim than, Thanks for your reply, I'm still getting blank results using the macro. but there is data in report.
The problem was that I was calling the refresh chart info from an existing EVDRE report/sheet.
I wanted to use this report because it's the classic menu report with diferent steps and calls.
If i cut/paste the button to the CHART sheet (EPM 10), it's working... strange....
At least I can refresh in the chart sheet, but I cannot call macro from this MENU Evdre sheet.
I'm getting some Clear Cache errors and i have to reconnect to. see again reports... maybe that's because the EVDRE/EPM mixing reports...
thanks -
Dear sir..
When i use your VBA Code and close my workbook after save workbook..
but again open workbook...VBA code is not working why ???I am not really sure what the problem is but here are a few notes that might help to identify it.
If you have any code that uses the following line:
Application.EnableEvents = False
then somewhere the following line must be also be executed.
Application.EnableEvents = True
If something occurs like a code fault that prevents the line to turn events back on from running then the events will not work until after you close Excel and re-open. (Not just close the workbook; but close the Excel application.)Alternatively,
in the VBA editor, you can open the Immediate window with Ctrl and G and insert the following line and press enter to turn events back on.
Application.EnableEvents = True
If the above is not the problem then all cells in a worksheet are Locked by default and that locked status is invoked when the worksheet is protected with the password. Therefore if you want the blank cells to be unlocked so that data can still
be entered then the code needs to unlock the blank cells by using an Else in the code like the following example.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cel As Range
ActiveSheet.Unprotect Password:="secret"
For Each cel In Target
If cel.Value <> "" Then
cel.Locked = True
Else
cel.Locked = False
End If
Next cel
ActiveSheet.Protect Password:="secret"
End Sub
Regards, OssieMac -
Excel 2013 crash - related to digital signature?
This is a cross-posting of a thread originally started in Microsoft Answers (Office- Excel) forum, advised to post in this forum by MS support engineer Mohan Suryanarayan (link to other forum: here).
I have a VB macro in file A (which otherwise contains only several Excel Tables with named ranges). My digital signature (for signing code) is attached to file A.
As the macro executes, the Open file dialog is called up so that the User can select a secondary file to open (file B or C).
Files B and C contain several sheets with formulas and Excel Tables, and also their own extensive VB macros. My digital signature is also attached to files B & C.
The remainder of the macro in file A simply executes an update of the Excel Tables in the secondary file, before saving & closing it.
I have been finding that during execution of the file A macro, Excel crashes and closes all open Excel files.
If I remove the digital signature from the secondary files then the macro in file A executes with no problem.
The macro was written in Excel 2007 and on a different laptop, with different digital signature, and used to have no problem at all. When a new laptop was purchased a new digital signature was obtained and placed into all of the files.
Execution of file A is a critical process - I need help with stopping the crash, while maintaining a digital signature in the secondary files (so that their own macros can execute).
Event Viewer error shows the following:
Faulting application name: EXCEL.EXE, version: 15.0.4667.1000, time stamp: 0x543d366c
Faulting module name: mso.dll, version: 0.0.0.0, time stamp: 0x5447696f
Exception code: 0xc0000602
Fault offset: 0x011aafdd
Faulting process id: 0x2d58
Faulting application start time: 0x01d01e17eafcd0bb
Faulting application path: C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE
Faulting module path: C:\Program Files (x86)\Common Files\Microsoft Shared\Office15\mso.dll
JL Latham replied:
Tom, all I can give you is relatively non-information. I haven't experienced that type of behavior even in Excel 2013 with digitally signed macros in multiple workbooks. But my digital signature is a commercial one from DigiCert, not
self-cert. I'm not even sure what piece of Excel or Office processes the digital signature (that is, whether it is mso.dll or not). But your whole process has more moving parts than most of mine involving multiple workbooks do - I quite often turn
off .EnableEvents when doing things like that just so event driven macros in the other workbook(s) do not execute.
Do the macros in the 'B files' have to execute during all of this processing in file A? If not, have you tried turning interrupts off:
Application.EnableEvents = False
before starting to work with the B-files? Maybe something in them, such as a Worksheet_Change() or other event triggered process is messing things up?
If you do use Application.EnableEvents=False, remember that you MUST re-enable that later in the code with Application.EnableEvents=True to get responses to things like button clicks, changes in a worksheet or other event driven processes
to run 'normally' again.
Have you looked at this discussion:
http://answers.microsoft.com/en-us/office/forum/office_2013_release-excel/excel-2013-crashing-immediately-when-attempting-to/ea2ab100-5525-4a0d-a3cf-6977319f954f
Sounds very similar to yours - original signature created in 2007, and crashing in 2013. Some suggestions were made, but whether they fixed the issue or not is unknown: OP never came back and said "fixed it" or "didn't fix it".
I replied:
In answer, the secondary B files don't execute any part of their macros during the A file process, and I hadn't included an EnableEvents = False within the file A code. However, I have just tried it to check if it made any difference and unfortunately it didn't.
I had read the thread you gave a link to before posting, and also the sub threads given within that one, but didn't see anything I thought of immediate parallel other than an Excel 2013 crash.
The way I read the linked thread was that a User added a signature in Excel 2007 and when they tried to open the file Excel (2007?) crashes, although other people using Excel 2013 can open it (not clear whether it means others can open the one with
the 2007 signature or without it).
Anyway, the differences in my situation are that:
(1) my B-files were originally created in Excel 2007 on a different laptop to current and had their own signature attached. I maintain a 'stock' of B-file versions, some of which have the old signature and some the new. If I run the A-file macro
on one of the B-files with the old signature then it executes ok;
(2) I am able to open the B-files ok, no matter whether the signature in them derives from the old laptop with Excel 2007 or the new laptop with Excel 2013;
(3) the macros within the B-files execute ok (this includes any versions of the B-files which still have an old signature attached, by removing the old signature and replacing with the new and executing on the new laptop);
(4) the offending operation which triggers the crash (when the B-files have the new signature attached) is a Resize of the Excel Tables within the B-file. I understand that I may eventually have to find a workaround for this operation but initially
I want to sort out the signature issue (I'm reasonably sure the signature issue is not a red herring where the Resize is the 'real' problem).
Regards, TomHi,
According to your description, this issue occurred with some particular files that stored in SharePoint site. Did the user download the file to local disk to print?
Based on the event log >>Faulting module name: EXCEL.EXE<<, it does not show the root Faulting module. Thus, please try to follow this KB to do general troubleshooting:
https://support.microsoft.com/en-us/kb/2758592
Then, if you have used "printer status application", please go to Device settings -> Installable options -> Printer Status notification and select disable.
If this issue still exists, we may need to collect the App crash dump file:
https://technet.microsoft.com/en-us/sysinternals/dd996900.aspx
You can try to analyze dump by yourself if you would like to:
How to analyze app crash dump file:
http://blogs.technet.com/b/askperf/archive/2007/05/29/basic-debugging-of-an-application-crash.aspx
Regards,
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs.
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected] -
Unwanted prefix of "Copy of " added to file name of opened Excel attachments
How can I stop the prefix of "Copy of " from being added to the file name when I save an Excel file that was mailed as an attachment?
It is very annoying to have to keep deleting that unwanted addition to my filenames.1) Don't open attachments - save them first and then open them.
2) You can use this code in the ThisWorkbook object of your Personal.xls:
Private WithEvents App As Application
Private Sub App_WorkbookBeforeSave(ByVal Wb As Workbook, ByVal SaveAsUI As Boolean, Cancel As Boolean)
If InStr(1, Wb.Name, "Copy of ") = 1 Then
Application.EnableEvents = False
Cancel = True
Wb.SaveAs Replace(Wb.FullName, "Copy of ", "")
Application.EnableEvents = True
End If
End Sub
Private Sub Workbook_Open()
Set App = Application
End Sub
HTH, Bernie
Maybe you are looking for
-
How to map the elements in Indesign document with the PDF elements
I wanted to know any way of mapping elements in the InDesign document with the elements in the exported PDF document from the same InDesign document. E.g If I have an Image X in InDesign document, Can I point out the same element in exported PDF usin
-
What is the correct Sun Java version for Plus ?
OK so I am running Version 1.4.2_06 (build 1.4.2_06-b03) for Disco Plus.. Is that the correct version ? I am trying to debug an error (Outstanding Refresh) and I need to eliminate the Java version being the cause: Can anyone confirm ? thanks OBX Orac
-
CSV file generation with timestamp time details
CREATE OR REPLACE PROCEDURE extract_proc AS l_rows number; begin l_rows := extract_function('select * from table1 where date1 between trunc(sysdate) and sysdate 'MYDIR1', 'test.csv'); end; I have a procedure extract_proc shown above which create a CS
-
Since I made the error of updating to the latest (at the time) iTunes a year ago..I haven't updated it since due to the horrors that happen after the initial update. So what's wrong with 7.4 that I need to avoid? I am on 7.3.054..and it works fine sa
-
How to find rejected rows using External Table
Hi all, I had written a stored procedure to read comma(,) separated flat file using External Tables in oracle 9i with Reject Limit "Unlimited" Option. Sometimes all rows are successfully loaded into external table and sometimes some rows are failed,