Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.access,microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Issues when opening excel through access

Hi Excel folk,

This is a cross-post from the Access group. As you can see from the short
history, the OP (Mary) is having trouble with an Auto_Open procedure which
seems to run fine when the spreadsheet is opened normally, but seems to fail
after RefreshAll when opened via automation. Would some of you fine folk
please take a look?

Mary: As you can see, I've cross-posted this to the Excel newsgroup, because
I don't speak Excel. Hopefully one of the experts in there can provide some
insight.

The only thing I can see is that there's a space after the dot ( Range
("A2"). Select ), but perhaps that's just a transcription problem. Mary,
would you check this please?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia


"marylander" wrote in message
...
Thanks Graham,

I changed the order however, the macros still stops on the first
command. The updating of the sheet.

Here is the code I have in Excel

Sheets("Rawdata").Select <------- linked to a table in Access
Range ("A1").Select
ActiveWorkbook.Refreshall
Range ("A2"). Select
Range (Selection,ACtiveCell.SpecialCells(xlLastCell)).Se lect
Selection.copy
Sheets("Transposed").Select
Range("B1").Select
Selection.PasteSpecial. Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _;=Falste,Transpose:=True
Sheets("Report").Select


It gets to the refresh comand and then stops


On Aug 3, 5:45 am, "Graham R Seach"
wrote:
Hi Mary,

I'm assuming you're launching an instance of Excel in code. In that case,
when you instantiate Excel, make it visible immediately. Only then open
the
spreadsheet. With any luck, this'll resolve the issue.

Set objXL = New.Excel.Application
objXL.Visible = True
DoEvents '***Very important

Set objXLWorkbook = objXL.Workbooks.Open(... ...)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

"marylander" wrote in message

...
The only issue I see is that it seems that once Access opens Excel .
Excel does not switch to a Sheet2 once it copies the information from
Sheet1. when I open Excel directly the macro runs without fail.

On Aug 1, 11:08 am, "Graham R Seach" <gseach@ac



cessmvp_REMOVE.com wrote:
I can't think of any reason why the macro wouldn't completely run when
the
sheet is opened via Access. You might check to see if there are any
conditions (for example, something that requires Excel to be visible or
have
mouse/keyboad focus perhaps).


Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia


"marylander" wrote in message


...


I have created the code to open an excel spreadsheet through access,
HOWEVER, in that excel spreadsheet there is an "Auto_Open" macro that
I want to run. Only one part of the macro runs upon the opening of
the Excel Spreadsheet through Access. If I open the spreadsheet
outside of access, the macro runs without issues.


Does Access control macros if it opens the spreadsheet, if so, is the
a way to transfer control to excel until the spreadsheet is closed.


thank you- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.access
external usenet poster
 
Posts: 3,355
Default Issues when opening excel through access

See response in Access forum for ideas.
--
HTH,
Barb Reinhardt



"Graham R Seach" wrote:

Hi Excel folk,

This is a cross-post from the Access group. As you can see from the short
history, the OP (Mary) is having trouble with an Auto_Open procedure which
seems to run fine when the spreadsheet is opened normally, but seems to fail
after RefreshAll when opened via automation. Would some of you fine folk
please take a look?

Mary: As you can see, I've cross-posted this to the Excel newsgroup, because
I don't speak Excel. Hopefully one of the experts in there can provide some
insight.

The only thing I can see is that there's a space after the dot ( Range
("A2"). Select ), but perhaps that's just a transcription problem. Mary,
would you check this please?

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia


"marylander" wrote in message
...
Thanks Graham,

I changed the order however, the macros still stops on the first
command. The updating of the sheet.

Here is the code I have in Excel

Sheets("Rawdata").Select <------- linked to a table in Access
Range ("A1").Select
ActiveWorkbook.Refreshall
Range ("A2"). Select
Range (Selection,ACtiveCell.SpecialCells(xlLastCell)).Se lect
Selection.copy
Sheets("Transposed").Select
Range("B1").Select
Selection.PasteSpecial. Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _;=Falste,Transpose:=True
Sheets("Report").Select


It gets to the refresh comand and then stops


On Aug 3, 5:45 am, "Graham R Seach"
wrote:
Hi Mary,

I'm assuming you're launching an instance of Excel in code. In that case,
when you instantiate Excel, make it visible immediately. Only then open
the
spreadsheet. With any luck, this'll resolve the issue.

Set objXL = New.Excel.Application
objXL.Visible = True
DoEvents '***Very important

Set objXLWorkbook = objXL.Workbooks.Open(... ...)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

"marylander" wrote in message

...
The only issue I see is that it seems that once Access opens Excel .
Excel does not switch to a Sheet2 once it copies the information from
Sheet1. when I open Excel directly the macro runs without fail.

On Aug 1, 11:08 am, "Graham R Seach" <gseach@ac



cessmvp_REMOVE.com wrote:
I can't think of any reason why the macro wouldn't completely run when
the
sheet is opened via Access. You might check to see if there are any
conditions (for example, something that requires Excel to be visible or
have
mouse/keyboad focus perhaps).


Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia


"marylander" wrote in message


...


I have created the code to open an excel spreadsheet through access,
HOWEVER, in that excel spreadsheet there is an "Auto_Open" macro that
I want to run. Only one part of the macro runs upon the opening of
the Excel Spreadsheet through Access. If I open the spreadsheet
outside of access, the macro runs without issues.


Does Access control macros if it opens the spreadsheet, if so, is the
a way to transfer control to excel until the spreadsheet is closed.


thank you- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening Excel issues M12s Setting up and Configuration of Excel 0 April 14th 08 04:39 PM
Date Format Issues Access to Excel RC Excel Discussion (Misc queries) 3 June 13th 06 11:28 AM
Issues with opening DBF (dBase) file in Excel EuroMaverick Excel Discussion (Misc queries) 1 February 15th 06 04:15 PM
Opening Excel Document in ASP.NET and having issues...please help Josh Behl[_2_] Excel Programming 0 November 11th 05 03:04 AM
Excel \ Access Time issues Marcus Excel Programming 2 July 8th 04 02:56 PM


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

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

About Us

"It's about Microsoft Excel"