A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Refresh and run Excel macro



 
 
Thread Tools Display Modes
  #1  
Old March 3rd, 2010, 11:34 PM posted to microsoft.public.access
nafflerbach
external usenet poster
 
Posts: 6
Default Refresh and run Excel macro

I have a table of data that changes daily and I need to update and save a
linked Excel spreadsheet with the new data. The spreadsheet is complex with
multiple tabs and formatting and therefore I cannot just export the table and
save. What I need to do from Access is open the Excel file, Refresh All and
then run one additional Excel Macro. Here is what I have so far but it fails
at the macro:

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Workbooks.Open "\\File Name.xls"
objExcel.Application.Visible = True
‘Need to refresh data before macro runs, not able to refresh on open.
objExcel.Run "File Name.xls!RefreshMacro Name"
objExcel.Run "File Name.xls!Macro Name"
objExcel.Quit

Can anyone help?
  #2  
Old March 4th, 2010, 01:30 AM posted to microsoft.public.access
Ken Snell
external usenet poster
 
Posts: 177
Default Refresh and run Excel macro

If you truly have spaces in the filename and macro name, then you need to
delimit those names with ' characters:

objExcel.Run "'File Name.xls'!'RefreshMacro Name'"

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
I have a table of data that changes daily and I need to update and save a
linked Excel spreadsheet with the new data. The spreadsheet is complex
with
multiple tabs and formatting and therefore I cannot just export the table
and
save. What I need to do from Access is open the Excel file, Refresh All
and
then run one additional Excel Macro. Here is what I have so far but it
fails
at the macro:

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Workbooks.Open "\\File Name.xls"
objExcel.Application.Visible = True
'Need to refresh data before macro runs, not able to refresh on open.
objExcel.Run "File Name.xls!RefreshMacro Name"
objExcel.Run "File Name.xls!Macro Name"
objExcel.Quit

Can anyone help?



  #3  
Old March 4th, 2010, 11:58 PM posted to microsoft.public.access
nafflerbach
external usenet poster
 
Posts: 6
Default Refresh and run Excel macro

Thanks Ken...There are no spaces in the actual file or macro names. So the
Excel file opens and the following message appears "This action will cancel a
pending Refresh Data command. Continue?

"Ken Snell" wrote:

If you truly have spaces in the filename and macro name, then you need to
delimit those names with ' characters:

objExcel.Run "'File Name.xls'!'RefreshMacro Name'"

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
I have a table of data that changes daily and I need to update and save a
linked Excel spreadsheet with the new data. The spreadsheet is complex
with
multiple tabs and formatting and therefore I cannot just export the table
and
save. What I need to do from Access is open the Excel file, Refresh All
and
then run one additional Excel Macro. Here is what I have so far but it
fails
at the macro:

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Workbooks.Open "\\File Name.xls"
objExcel.Application.Visible = True
'Need to refresh data before macro runs, not able to refresh on open.
objExcel.Run "File Name.xls!RefreshMacro Name"
objExcel.Run "File Name.xls!Macro Name"
objExcel.Quit

Can anyone help?



.

  #4  
Old March 5th, 2010, 10:19 PM posted to microsoft.public.access
Ken Snell
external usenet poster
 
Posts: 177
Default Refresh and run Excel macro

Do you have some VBA code / macro running on the workbook's Open event? or
some other workbook event? Do you have formulas in the worksheet that are
being recalculated/refreshed upon opening?

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
Thanks Ken...There are no spaces in the actual file or macro names. So
the
Excel file opens and the following message appears "This action will
cancel a
pending Refresh Data command. Continue?

"Ken Snell" wrote:

If you truly have spaces in the filename and macro name, then you need to
delimit those names with ' characters:

objExcel.Run "'File Name.xls'!'RefreshMacro Name'"

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
I have a table of data that changes daily and I need to update and save
a
linked Excel spreadsheet with the new data. The spreadsheet is complex
with
multiple tabs and formatting and therefore I cannot just export the
table
and
save. What I need to do from Access is open the Excel file, Refresh
All
and
then run one additional Excel Macro. Here is what I have so far but it
fails
at the macro:

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Workbooks.Open "\\File Name.xls"
objExcel.Application.Visible = True
'Need to refresh data before macro runs, not able to refresh on open.
objExcel.Run "File Name.xls!RefreshMacro Name"
objExcel.Run "File Name.xls!Macro Name"
objExcel.Quit

Can anyone help?



.



  #5  
Old March 8th, 2010, 07:45 PM posted to microsoft.public.access
nafflerbach
external usenet poster
 
Posts: 6
Default Refresh and run Excel macro

None that I am aware of. I also turned the calcultions to manual. Still no
good.

"Ken Snell" wrote:

Do you have some VBA code / macro running on the workbook's Open event? or
some other workbook event? Do you have formulas in the worksheet that are
being recalculated/refreshed upon opening?

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
Thanks Ken...There are no spaces in the actual file or macro names. So
the
Excel file opens and the following message appears "This action will
cancel a
pending Refresh Data command. Continue?

"Ken Snell" wrote:

If you truly have spaces in the filename and macro name, then you need to
delimit those names with ' characters:

objExcel.Run "'File Name.xls'!'RefreshMacro Name'"

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
I have a table of data that changes daily and I need to update and save
a
linked Excel spreadsheet with the new data. The spreadsheet is complex
with
multiple tabs and formatting and therefore I cannot just export the
table
and
save. What I need to do from Access is open the Excel file, Refresh
All
and
then run one additional Excel Macro. Here is what I have so far but it
fails
at the macro:

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Workbooks.Open "\\File Name.xls"
objExcel.Application.Visible = True
'Need to refresh data before macro runs, not able to refresh on open.
objExcel.Run "File Name.xls!RefreshMacro Name"
objExcel.Run "File Name.xls!Macro Name"
objExcel.Quit

Can anyone help?


.



.

  #6  
Old March 9th, 2010, 02:27 AM posted to microsoft.public.access
Ken Snell
external usenet poster
 
Posts: 177
Default Refresh and run Excel macro

What is the security setting for macros on the EXCEL application where
you're running the code? Does the file ask if the macros should be trusted
when the file opens?

--

Ken Snell
http://www.accessmvp.com/KDSnell/


"nafflerbach" wrote in message
...
None that I am aware of. I also turned the calcultions to manual. Still
no
good.

"Ken Snell" wrote:

Do you have some VBA code / macro running on the workbook's Open event?
or
some other workbook event? Do you have formulas in the worksheet that are
being recalculated/refreshed upon opening?

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
Thanks Ken...There are no spaces in the actual file or macro names. So
the
Excel file opens and the following message appears "This action will
cancel a
pending Refresh Data command. Continue?

"Ken Snell" wrote:

If you truly have spaces in the filename and macro name, then you need
to
delimit those names with ' characters:

objExcel.Run "'File Name.xls'!'RefreshMacro Name'"

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
I have a table of data that changes daily and I need to update and
save
a
linked Excel spreadsheet with the new data. The spreadsheet is
complex
with
multiple tabs and formatting and therefore I cannot just export the
table
and
save. What I need to do from Access is open the Excel file, Refresh
All
and
then run one additional Excel Macro. Here is what I have so far but
it
fails
at the macro:

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Workbooks.Open "\\File Name.xls"
objExcel.Application.Visible = True
'Need to refresh data before macro runs, not able to refresh on
open.
objExcel.Run "File Name.xls!RefreshMacro Name"
objExcel.Run "File Name.xls!Macro Name"
objExcel.Quit

Can anyone help?


.



.



  #7  
Old March 13th, 2010, 05:47 PM posted to microsoft.public.access
De Jager
external usenet poster
 
Posts: 393
Default Refresh and run Excel macro


"nafflerbach" wrote in message
...
I have a table of data that changes daily and I need to update and save a
linked Excel spreadsheet with the new data. The spreadsheet is complex
with
multiple tabs and formatting and therefore I cannot just export the table
and
save. What I need to do from Access is open the Excel file, Refresh All
and
then run one additional Excel Macro. Here is what I have so far but it
fails
at the macro:

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Workbooks.Open "\\File Name.xls"
objExcel.Application.Visible = True
‘Need to refresh data before macro runs, not able to refresh on open.
objExcel.Run "File Name.xls!RefreshMacro Name"
objExcel.Run "File Name.xls!Macro Name"
objExcel.Quit

Can anyone help?


  #8  
Old March 17th, 2010, 01:47 PM posted to microsoft.public.access
joelgeraldine
external usenet poster
 
Posts: 201
Default Refresh and run Excel macro

jjkjjkjkj

"Ken Snell" a écrit dans le message de
groupe de discussion : ...
Do you have some VBA code / macro running on the workbook's Open event? or
some other workbook event? Do you have formulas in the worksheet that are
being recalculated/refreshed upon opening?

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
Thanks Ken...There are no spaces in the actual file or macro names. So
the
Excel file opens and the following message appears "This action will
cancel a
pending Refresh Data command. Continue?

"Ken Snell" wrote:

If you truly have spaces in the filename and macro name, then you need
to
delimit those names with ' characters:

objExcel.Run "'File Name.xls'!'RefreshMacro Name'"

--

Ken Snell
http://www.accessmvp.com/KDSnell/



"nafflerbach" wrote in message
...
I have a table of data that changes daily and I need to update and save
a
linked Excel spreadsheet with the new data. The spreadsheet is
complex
with
multiple tabs and formatting and therefore I cannot just export the
table
and
save. What I need to do from Access is open the Excel file, Refresh
All
and
then run one additional Excel Macro. Here is what I have so far but
it
fails
at the macro:

Dim objExcel As Object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Workbooks.Open "\\File Name.xls"
objExcel.Application.Visible = True
'Need to refresh data before macro runs, not able to refresh on open.
objExcel.Run "File Name.xls!RefreshMacro Name"
objExcel.Run "File Name.xls!Macro Name"
objExcel.Quit

Can anyone help?


.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.