View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Using a Range variable to call a procedure with a ByVal statem

If you are trying to ope a workbook then:

Workbooks.Open filename:=Range("O2").Value

I assume the Range("O2") has the path and file name. I don't know what the
argument cutrange means. It is not in the standard list of arguments for
workbooks.open

"R Tanner" wrote:

On Sep 17, 12:47 pm, JP wrote:
The Workbook_Open event doesn't take any arguments. It is placed in
the ThisWorkbook module for a workbook and runs when that workbook is
opened. Where did you come up with that code?

--JP

On Sep 17, 2:23 pm, R Tanner wrote:



Hi,


I am trying to call a procedure and I can't figure out how to do it
correctly. This is my call statement.


WorkBook_Open
(filename:=Range("O2").Value,cutrange:=range("O5") .address)


The following is the procedure I am trying to call:


Private Sub WorkBook_Open(ByVal FileName As String, ByVal CutRange As
Range)- Hide quoted text -


- Show quoted text -


Okay I changed the name to just Book_Open. It still doesn't work. I
want to pass two variables to this Book_Open procedure....what am I
doing wrong?