473,569 Members | 2,729 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 1542
NeoPa
32,564 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,564 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,564 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 machine (it is out of my control to know what versions of Excel different users has.) Anyway let us say that Excel 2000 is the oldest acceptable...
6
14547
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 I can't see it using the Excel Tools/Add-Ins - Automation button. Now this appears to be because it is not an *ActiveX* COM object, apparently in...
17
6320
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
3967
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
3464
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 there, but I'm having trouble with the following code: **************** Code Starts Here *********** Excel.Application m_objExcel;...
5
3026
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 the below API: TargetWorkbook.Save TargetWorkbook.Close
3
2175
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! Thanks! -- - Mitchell Vincent - kBilling - Invoices Made Easy!
1
1704
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 automation breaks on those machines. Does coding to the earliest supported version of Excel not apply once you get to 2003?
14
6882
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 would be appreciated. Here is my code. Dim oXL As Excel.Application Dim oWB As Excel.Workbook Dim oSheet As Excel.Worksheet
3
2471
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 system.process even after the user closes the excel file generated. Here is the code block I'm using Dim oExcelApp As Excel.Application
0
7695
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7668
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.