473,503 Members | 3,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel Automation debug issue

TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
I this piece of code in excel:
Expand|Select|Wrap|Line Numbers
  1. With wrkSheet.Range("A" & intL, "G" & intL)
  2.   .Merge
  3.   .Value = rsGroup!tx_GroupTitle
  4.   .Font.Name = "Calibri"
  5.   .Font.Bold = True
  6.   .font.Size = 11
  7. End With
It is part of a do loop, where intL keeps track of the line number I have reached, and I have set a breakpoint at the beginning of the loop, and I am now stepping through the code using F8. When line 3 is executed, it can best be described as if VBE believes I have pressed F5 instead of F8, the code runs until the next breakpoint.

I know that the code lines 4 and 5 and so on are executed, and I know that no error is thrown. If I put a breakpoint on line 4 VBE will stop and break.

Has anyone else ever encountered such an issue?
Apr 19 '12 #1
5 1539
NeoPa
32,557 Recognized Expert Moderator MVP
Just read it Smiley. This happens sometimes when Excel determines that it cannot use the stepping feature (or that same feature fails for some reason).
Apr 19 '12 #2
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Thank you. Do you have a link to some official source? I did find some vaguely related posts, but nothing with a more detailed explanation.
Apr 20 '12 #3
NeoPa
32,557 Recognized Expert Moderator MVP
Sorry no. I just experienced it a few times over the years.

In real code it's easier to understand, as the intel processors are all based on the same basic architecture and stepping through (processor-level) code is handled by a hardware interrupt being dedicated to that specific feature. If ever something interfered with the interrupt table in RAM (as some code would, particularly when trying to avoid anyone determining what it was doing) then the step-through interrupt would fire, but divert the thread of the code to somewhere undefined and everything went belly-up.

I doubt that a debugger for semi-compiled code could possibly work in the same way though, in as much as a line of VBA code could hardly ever relate to a single processor instruction. My guess is that a more standard breakpoint (another processor interrup) is used and is placed at the point (or points) where that line would finish at. I have no hypothesis as to why that might result in the behaviour you've seen, but it's as far as I ever got I'm afraid. It could simply be a fault in the logic of the debugger that's never been identified and fixed (for all I know).
Apr 20 '12 #4
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
Thank you again. The first time I saw it, I kept thinking the code exited or errored or something. Took me a while to track down the issue, to the Step-Through not working as expected.

I should probably have mentioned this is happening to me in Office 2010 on windows 7, but from what I hear from you, it has happened to you on earlier platforms as well.

Have you ever experienced it when running directly from excel (or another office application) and not when using automation?
Apr 20 '12 #5
NeoPa
32,557 Recognized Expert Moderator MVP
To be honest it's so long now since I remember it happening that I can't say for sure, though that long ago I wasn't doing much automation. I had a short spell using it in 1999, then didn't need it again until someone asked about it on Bytes in the later noughties. Then I genned back up on it and now I use it whenever it presents itself as a sensible solution.
Apr 20 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
858
by: Benjamin | last post by:
I am making a Windows EXE (.NET Visual Basic Windows Application). I would like to make it possible to open Excel Worksheets from my EXE. This should work independent of Excel version on client...
6
14535
by: Frank X | last post by:
Excel 2002 introduced a capability to add custom worksheet functions to Excel direct from a COM/ActiveX object. I can use C# to develop a COM object which I can use fine from Excel/VBA, however...
17
6301
by: Mansi | last post by:
I need to do some research on how to use excel automation from c#. Does anyone know of any good books related to this subject? Thanks. Mansi
3
3947
by: Mansi | last post by:
What are the advantages/disadvantages of using Excel Automation vs. Ado.Net when it comes to reading and writing records in an Excel workbook with Visual C#.Net? Thanks. Mansi
3
3460
by: Mansi | last post by:
I'm trying to use excel automation (from visual c# .NET) to fill data in a range by using arrays. I am using Microsoft's Knowledge Base Article 302096 as a reference and using the example listed...
5
3025
by: Wenke Ji | last post by:
Hi I open a Excel workbook using below API: Set ExcelServer = CreateObject("EXCEL.Application") Set TargetWorkbook = ExcelServer.Workbooks.Open (CurrentBook) Befor the programm exit , I use...
3
2161
by: Mitchell Vincent | last post by:
Does anyone have some good examples of Excel automation with (VB).NET? I have some Excel spreadsheets that a customer needs parsed out but I've never tried to use Excel programatically before! ...
1
1701
by: Troy | last post by:
I have VB.Net code that opens Excel files and imports data from them. It works fine for all versions up to 2003 and has for over a year. We have users updating to Office 2003 and the Excel...
14
6875
by: cj | last post by:
I want to start a workbook and add sheets to it one at a time. Right now my code opens a workbook and it has 3 sheets alread in it and I don't even know how to move from one to another. Any help...
3
2469
by: Satish Itty | last post by:
Hi all, I using excel automation to generate some reports in excel. I guess I'm not doing it correctly because Every time the report is run it leaves a Excel.exe process open in the...
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4665
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.