ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling? Invoke Public Function (https://www.excelbanter.com/excel-programming/381463-re-calling-invoke-public-function.html)

Chip Pearson

Calling? Invoke Public Function
 
When you're using Run, you don't include the path name of the file, only the
file name (e..g, "Book1.xls" not "C:\Test\Book1.xls"). Excel cannot have
two workbooks with the same file name open at the same time, so the Path is
irrelevant.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"David" wrote in message
...
Code:
Sub Chap7()
' Macro4 Macro
Dim FileName As String
z = 1
x = 0
Debug.Assert z < 0
Debug.Assert x < 0
On Error Resume Next
v = z / x
If Err.Number < 0 Then
Result = Application.Run("C:\Documents and
Settings\Owner\MyDocuments\Excel\VBA\Excel2003VBA! ErrorInformation", _
Err.Number, Err.Source, Err.Description, ActiveWorkbook.Name)
End If
(Trying to get above what is produced by below)
'If Err.Number < 0 Then
' Msg = "Error # " & Str(Err.Number) & " was generated by/ " _
' & Err.Source & Chr(13) & Err.Description & "/ " &
ActiveWorkbook.Name
' MsgBox Msg, , "Error", Err.HelpFile, Err.HelpContext
'End If
End Sub

Tried to use a Call, but was not allowed, so I am trying to do a Run.
--
David





All times are GMT +1. The time now is 12:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com