ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   calling sub from other workbook (https://www.excelbanter.com/excel-programming/427900-calling-sub-other-workbook.html)

pls123

calling sub from other workbook
 
hi all !
i have the main workbook that must make his calulations,
then all other workbooks will copy updated values,

so to have total control of the flow..
i need to call the copying macro of the secundary pages,
from the main page ..

i got this from a friend of the forum..to call the macro
in each workbook wich name begins with "_" character

for better control..


For Each wb In Workbooks
If (left(wb.name,1) )= "_" Then
'Call Mia
End if
Next wb


but it doesn't work , reporting debug problem for each "wb"..

this is the workbook where it must be placed, but necessarily after the
"call plt" row
tx all for attention with my bad grammar !!


Public Sub RunTimer()

Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")

With aWS.Range("O8")
.Value = .Value + TimeSerial(0, 0, 2)
.NumberFormat = "hh:mm:ss"
End With
nTime = Now + TimeSerial(0, 0, 2)
Call plt
Application.OnTime nTime, "RunTimer"

End Sub

ryguy7272

calling sub from other workbook
 
Something like this should get you close:
http://www.rondebruin.nl/ado.htm
http://www.rondebruin.nl/copy7.htm

HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"pls123" wrote:

hi all !
i have the main workbook that must make his calulations,
then all other workbooks will copy updated values,

so to have total control of the flow..
i need to call the copying macro of the secundary pages,
from the main page ..

i got this from a friend of the forum..to call the macro
in each workbook wich name begins with "_" character

for better control..


For Each wb In Workbooks
If (left(wb.name,1) )= "_" Then
'Call Mia
End if
Next wb


but it doesn't work , reporting debug problem for each "wb"..

this is the workbook where it must be placed, but necessarily after the
"call plt" row
tx all for attention with my bad grammar !!


Public Sub RunTimer()

Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")

With aWS.Range("O8")
.Value = .Value + TimeSerial(0, 0, 2)
.NumberFormat = "hh:mm:ss"
End With
nTime = Now + TimeSerial(0, 0, 2)
Call plt
Application.OnTime nTime, "RunTimer"

End Sub



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

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