Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Problem in Macro

  Asked By: Violet    Date: Oct 16    Category: MS Office    Views: 609
  

I am trying to run a macro but I encounter debug. The process is as follows:

--> I want to copy the data from my data server and paste the same into excel.

--> I want to autorun the macro after every half an hour. Can it we possible.

It would be appreciated if anyone of you can fix my problem.

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Bohdana Nonob     Answered On: Oct 16

There's not quite enough info for us to help.
"I encounter a debug"..
Ok... what is the code, and when you get the "debug", what is the error, and
what line is it stopping on?

if you want it to run  every 1/2 your, you can set up a scheduled task to open
the excel  file.
But keep in mind that it will tie up your Excel session every 1/2 hour, so you
may want to run it on a
machine that isn't being used by a user.

or... you said you want to "paste it into excel".
Is the Excel file just a collection of data? Is the data  being pasted to the
end of a list of data?
If so, perhaps you can just append the data to a comma separated file that can
be used by Excel.

 
Answer #2    Answered By: Atid Boonliang     Answered On: Oct 16

The process  involves copy  the data  from a database (a server  in a company) and
the paste  the same into excelsheet. This process is it to repeated after half an
hour as trades get append on the database.

Now the error here is that a recorded a macro  for the process but when I run  the
macro it debug  saying "ActiveSheet.Paste". Do u want the entire coding?

 
Answer #3    Answered By: Hayden Evans     Answered On: Oct 16

If the database Server is SQL Server, then you can set up a DTS package to
run every 30 mins.
The DTS package will just run  every 30 mins, and copies over the data  into
an excel  file.
I hope this helps.

 
Answer #4    Answered By: Sairah Hashmi     Answered On: Oct 16

Is what you described: "ActiveSheet. Paste" accurate?
If it is, then the problem  is with the "space" before the "Paste"
It should read "ActiveSheet.Paste". (no spaces)

Now, to carry your question further:
Is it your intent to have the excel  file Opened every 1/2 hour to do this
update?
If so, as I mentioned in my previous response, it will be VERY distracting for
any
user sitting at the computer where this job is running.
My earlier comments were inquiring whether having a VBScript job run  every 1/2
hour and update a .dat file. Then, when a user launches your application, it
would
go out and retrieve the latest data  from the file.
this would work, unless you're doing quite a bit more than just copy/pasting
data
into an Excel file.

I guess I shouldn't try to re-engineer your process, and just help by answering
the question
asked.

so.. if the above mentioned "space" is not the problem, I'll need more of the
code and the
exact wording of the error to be able to address your problem.

 
Didn't find what you were looking for? Find more on Problem in Macro Or get search suggestion and latest updates.




Tagged: