ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   workbook_open execute macro (https://www.excelbanter.com/excel-programming/360549-workbook_open-execute-macro.html)

ina

workbook_open execute macro
 
hello,

I would to open my macro and automatically execute my macro in the
sheet1 and another in sheet2

Private Sub Workbook_Open()

Sheets("Clients").GetInfo "John"
Sheets("Room29.GetInfoRoom

End Sub

But doesn't work?

Ina


Tom Ogilvy

workbook_open execute macro
 
Private Sub Workbook_Open()

Sheet1.GetInfo "John"
Sheet2.GetInfoRoom

End Sub

--
Regards,
Tom Ogilvy


"ina" wrote:

hello,

I would to open my macro and automatically execute my macro in the
sheet1 and another in sheet2

Private Sub Workbook_Open()

Sheets("Clients").GetInfo "John"
Sheets("Room29.GetInfoRoom

End Sub

But doesn't work?

Ina



ina

workbook_open execute macro
 
thanks Tom : D

Ina


ina

workbook_open execute macro
 
What means " method or data member not found" do you thing Do i need
set my GetInfo into private sub

Ina


Tom Ogilvy

workbook_open execute macro
 
Make your procedure public

Public GetInfo( s as String)


end Sub

--
Regards,
Tom Ogilvy




"ina" wrote:

What means " method or data member not found" do you thing Do i need
set my GetInfo into private sub

Ina



ina

workbook_open execute macro
 
Thanks, Can I also make a function public?


Tom Ogilvy

workbook_open execute macro
 
Yes you can.

--
Regards,
Tom Ogilvy


"ina" wrote:

Thanks, Can I also make a function public?



ina

workbook_open execute macro
 
it is ok and i have insert in each sheet the sub going there (getInfo
and GetInfoRoom ) and in the workbook I insert this code

Sub workbook_open()

Sheet1.GetInfo
Sheet2.GetInfoRoom

End Sub

the macro in sheet2 is executing in sheet1and I do not know why?


Tom Ogilvy

workbook_open execute macro
 
Sub workbook_open()

Sheet1.Activate
Sheet1.GetInfo
sheet2.Activate
Sheet2.GetInfoRoom

End Sub

--
regards,
Tom Ogilvy


"ina" wrote:

it is ok and i have insert in each sheet the sub going there (getInfo
and GetInfoRoom ) and in the workbook I insert this code

Sub workbook_open()

Sheet1.GetInfo
Sheet2.GetInfoRoom

End Sub

the macro in sheet2 is executing in sheet1and I do not know why?



ina

workbook_open execute macro
 
Thank you a lot :D

and one more question when I can my file from a script (vbscript) the
macro is not been executed; Do I Need do something in the vba code or
vbscriptcode?

Ina


Tom Ogilvy

workbook_open execute macro
 
Unless you have security set to high or have your code disable macros, I
would expect the workbook_open event to fire if it is in the Thisworkbook
module.

--
Regards,
Tom Ogilvy


"ina" wrote:

Thank you a lot :D

and one more question when I can my file from a script (vbscript) the
macro is not been executed; Do I Need do something in the vba code or
vbscriptcode?

Ina



ina

workbook_open execute macro
 
yes i will check here ... but now my head blow off. Thank you a lot for
your advices

Ina



All times are GMT +1. The time now is 09:06 AM.

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