Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8533965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:05:11+00:00 2026-06-11T10:05:11+00:00

(edit: On subsequent edit, the poster declared that the problem had been solved and

  • 0

(edit: On subsequent edit, the poster declared that the problem had been solved and had been due to a spelling error then deleted the entire question text. Text restored with addition of this comment)


I have 2 macros that i need to scheduled:

Macro1 “GetData” – this needs to run every 35mins – to retrieve data from my DB.
Macro2 “RefreshData” – this needs to run every 1min after GetData is complete – to update my data.

I have tried:

Private Sub workbook_open()

Application.OnTime Now + TimeValue("00:35:10"), "GetData"
Application.OnTime Now + TimeValue("00:01:00"), "RefreshData"

End Sub

However, i am presented with:

“Cannot run the macro “c:\document and settings\alex\desktop\data.xlsm’!GetData’/ The macro may not be available in this workbook or all macro’s may be disabled”

Sub GetData ()

'' GetData ///////////////////////////////////////////////////////////////////////

Dim sh1 As Worksheet, data As Worksheet

Set sh1 = Worksheets("Sheet1")

Set data = Workbooks.Open(Filename:="C:\Documents and Settings\alex\Desktop\source.XLS"). _
    Worksheets("Report 1")

Sheets("Report 1").Select
Set Rng = Sheets("Report 1").Range("A2:K350")
Selection.Copy

sh1.Activate
Rng.SpecialCells(xlCellTypeVisible).Copy Destination:=Sheets("Sheet1").Range("A2")

portfolioName.Activate
ActiveWorkbook.Close

End Sub

Sub RefreshData()

MsgBox ("-- Update every 1min --")

End Sub

Any help appreciated.

— Update ——-

I have now created a separate GetData module:

Private Sub workbook_open()

Application.OnTime Now + TimeValue("00:35:10"), "GetData"
'Application.OnTime Now + TimeValue("00:01:00"), "RefreshData"

End Sub

Public Sub GetData()
'' GetData ///////////////////////////////////////////////////////////////////////
....
....
End Sub

Still receive same error..

— Update——

Ok, within Sheet1 i have:

Public Sub workbook_open()

Application.OnTime Now + TimeValue("00:35:10"), "GetData"
'Application.OnTime Now + TimeValue("00:01:00"), "RefreshData"

End Sub

I have now Insert > Module and renamed the module to GetData

Within that GetData module i have:

Public Sub GetData()
'' GetData ///////////////////////////////////////////////////////////////////////
....
....
End Sub

Any comments welcome

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:05:13+00:00Added an answer on June 11, 2026 at 10:05 am

    OnTime requires the referenced macro to be in a standard module. The sub must also be public, which is default for a module. Insert a module, and move GetData and RefreshData into it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: I was an idiot. I simply had an image that was vertically long,
EDIT: See my answer below--> I am wanting to have a view that when
EDIT: iam using ajax to load text in my content that is why onload
Edit : Note that, as Daniel and latkin noted in an answer and a
EDIT : It turned out that this can only be done through an external
EDIT: This question is solved, but I can't accept my own answer just yet.
I have a modelform that will either create a new model or edit an
After uninstalling VS 2010 and reinstalling, and then subsequent reinstallation of MVC4, I am
EDIT I added in some error handling to my .vbs file and it is
I am creating an ASP.NET application that allows users to edit and insert data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.