Access to excel problem

cornishteeth

Board Regular
Joined
Dec 6, 2002
Messages
117
I have a report that needs to be viewed in an excel
spreadsheet. I want to create a macro that opens the
report as an excel spreadsheet for viewing, and then sends
that object via outlook once I allow it to go. I know how
to send object, its just a problem with getting the
spreadsheet to open for viewing. I can get it to save on
my desktop, but not automatically open. Can anyone help.

Frank
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
What code do you already have?

When do you want to view the spreadsheet?
 
Upvote 0
I was trying to do it via the Macro functions built into access. I want to view the spreadsheet when I depress the command button prompting the sheet to open. My programming of VB is limited. Does this task require VB code to accomplish?

Frank
 
Upvote 0
Frank

Have you looked at the RunApp macro action. That might be what you need.

If that doesn't work then try converting what you the macros you have already into Visual Basic

(Tools>Macro>Convert Macros to Visual Basic when in the Macro Tab).

Post that code and maybe we can help.
 
Upvote 0
Function Macro345()
On Error GoTo Macro345_Err

DoCmd.OpenReport "new arrivals", acPreview, "", "[STU DATA]![Report Date]>[Forms]![MENTORING]![Text0]-1"
DoCmd.SendObject acReport, "new arrivals", "MicrosoftExcel(*.xls)", "", "", "", "", "", False, ""


Macro345_Exit:
Exit Function

Macro345_Err:
MsgBox Error$
Resume Macro345_Exit

End Function

Here is what the macro does so far. In between opening the report and sending the report off, I want to be able to convert the open report to excel and view it prior to sending the object. Does this make sense?

Frank
 
Upvote 0
Frank

The first thing I noticed is that you don't seem to be actually creating an Excel spreadsheet from the report.

Your just sending it in Excel format.

I don't know exactly how Access does this but it probably creates a temporary xls somewhere.

I think you'll need to look at actually exporting the report to Excel then opening it.

BTW did you look at the RunApp method?
 
Upvote 0
From what I gather, the RunApp just opens up a blank excel spreadsheet. I don't know how it would apply. I can currently do what you said. Change the report to and excel spreadsheet and save it on my harddrive. Then I need to go the file, open it up, verify it, then send it out in outlook. I was trying to have access open it up in excel, let me look at it, and when I accept it, send it out in outlook.

Frank
 
Upvote 0
Frank

Does the RunApp method not take any arguments, like filename?
 
Upvote 0
Changed the command line to ...

C:\Program Files\Microsoft Office\Office\excel.exe C:\newarrivals.xls

and it worked.

Thanks
 
Upvote 0

Forum statistics

Threads
1,221,845
Messages
6,162,350
Members
451,760
Latest member
samue Thon Ajaladin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top