ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple line error msg (https://www.excelbanter.com/excel-programming/413370-simple-line-error-msg.html)

James8309

Simple line error msg
 
Hi everyone,

one of my line in my VBA code is ;

Workbooks.Open Filename:="G:\ReportFiles\ReportTemplate.xls"


and I do not understand why this line creates "Invalid Procedure call
or argument"

Please help

thank you,


Nigel[_2_]

Simple line error msg
 
If the path and file exists then the code line is correct. Are you
assigning this to a object? If so use

Set wbkNew = Workbooks.Open ("G:\ReportFiles\ReportTemplate.xls")

--

Regards,
Nigel




"James8309" wrote in message
...
Hi everyone,

one of my line in my VBA code is ;

Workbooks.Open Filename:="G:\ReportFiles\ReportTemplate.xls"


and I do not understand why this line creates "Invalid Procedure call
or argument"

Please help

thank you,



James8309

Simple line error msg
 
On Jul 1, 3:55*pm, "Nigel" wrote:
If the path and file exists then the code line is correct. *Are you
assigning this to a object? If so use

Set wbkNew = *Workbooks.Open ("G:\ReportFiles\ReportTemplate.xls")

--

Regards,
Nigel


"James8309" wrote in message

...



Hi everyone,


one of my line in my VBA code is ;


Workbooks.Open Filename:="G:\ReportFiles\ReportTemplate.xls"


and I do not understand why this line creates "Invalid Procedure call
or argument"


Please help


thank you,- Hide quoted text -


- Show quoted text -



Directory is there, file is there, It even opens up when I execute the
macro but after opening the file, it returns the same error. Even if I
use your code it creates an error. When I click debug to see where the
error occured, it is the same line.

Is this because of the excel file that I am trying to open ?

I am only doing this because I have a seperate macro that need to be
done in :="G:\ReportFiles\ReportTemplate.xls"

Is there anyway I can run the macro from other workbook in the current
workbook?

if I do "Application.Run "ReportTemplate.xls'!Macro_B" will it work?

Dave Peterson

Simple line error msg
 
Did you create any subroutines/functions called Open?
Did you name any of your modules Open?


James8309 wrote:

Hi everyone,

one of my line in my VBA code is ;

Workbooks.Open Filename:="G:\ReportFiles\ReportTemplate.xls"

and I do not understand why this line creates "Invalid Procedure call
or argument"

Please help

thank you,


--

Dave Peterson

James8309

Simple line error msg
 
On Jul 1, 9:53*pm, Dave Peterson wrote:
Did you create any subroutines/functions called Open?
Did you name any of your modules Open?

James8309 wrote:

Hi everyone,


one of my line in my VBA code is ;


Workbooks.Open Filename:="G:\ReportFiles\ReportTemplate.xls"


and I do not understand why this line creates "Invalid Procedure call
or argument"


Please help


thank you,


--

Dave Peterson


Nope :(

Dave Peterson

Simple line error msg
 
Sorry, I don't have another guess.

Does the code work in a brand new workbook's project?

I bet it does, so there's something bad going on in that original workbook.

James8309 wrote:

On Jul 1, 9:53 pm, Dave Peterson wrote:
Did you create any subroutines/functions called Open?
Did you name any of your modules Open?

James8309 wrote:

Hi everyone,


one of my line in my VBA code is ;


Workbooks.Open Filename:="G:\ReportFiles\ReportTemplate.xls"


and I do not understand why this line creates "Invalid Procedure call
or argument"


Please help


thank you,


--

Dave Peterson


Nope :(


--

Dave Peterson


All times are GMT +1. The time now is 08:34 AM.

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