Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

VB code acts like a breakpoint is set, but none is set.

$
0
0

I have a routine to process a file, as an Auto_open Macro.  It runs when the spreadsheet is opened, and works properly, until the point where it is supposed to open a workbook.  At this point the VB window opens, the code stops, with the command to open a file highlighted in yellow. There are no error messages, no dialog boxes, and nothing wrong with the chosen file or the code that I can find. 

It acts exactly like there is a breakpoint set on this line, but there is no breakpoint.  The relevant code follows, and the line before the last is where it fails.

Phil

==========================================================

Dim NewFileName As String
 Dim lastrow As Integer
 
 ChosenFile = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls), *.xls", Title:="Please select file to process")
If ChosenFile = False Then
' Canceled
MsgBox "No File Chosen"
Exit Sub
Else
Debug.Print ChosenFile
Workbooks.Open FileName:=ChosenFile
End If


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>