Outlook to open excel

maxx_daddy

Board Regular
Joined
Dec 3, 2010
Messages
74
Hi all again,
Ok so my code snippeting has gotten me this far.
I open a workbook from outlook via this code:
Sub XL_Test()
Dim myXLApp As Excel.Application
Dim myXLWB As Excel.Workbook
On Error Resume Next
Set myXLApp = GetObject(, "Excel.Application")
If myXLApp Is Nothing Then 'No instance of Excel is available
Set myXLApp = CreateObject("Excel.Application")
End If
Workbooks.Open "C:\Users\Joe\Desktop\R-MailJoe.xlsm"
End Sub

That "opens" the work book, but I cannot see it, it doesn't pop up or show up on my screen/task bar, but a quick look at the task manager and sure enough, there is excel.exe.

I will run all of the copy/paste code (want to snag the subject and addressee and paste) from excel, but getting it opened and usable is the secret.
What did i do wrong?
Thanks,

edit: also I know it has opened the correct work book because if i try to open normally it tells me it is aready open.

joe
 
Last edited:

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Code:
myXLApp.Visible = True
 
Upvote 0
I am okay if next time, you can use
Code:
 tags around your code.
Thanks in advance for considering this.
 
Upvote 0
Code:
Sub XL_Test()
Dim myXLApp As Excel.Application
Dim myXLWB As Excel.Workbook
On Error Resume Next
Set myXLApp = GetObject(, "Excel.Application")
If myXLApp Is Nothing Then 'No instance of Excel is available
Set myXLApp = CreateObject("Excel.Application")
End If
Workbooks.Open "C:\Users\Joe\Desktop\R-MailJoe.xlsm"
End Sub
[code]
 
(testing)
 
help, what am i doing wrong, sure would like to do it right
 
Last edited:
Upvote 0
Hi

The second time
Code:
 should have a / in front of code.
It is the closing tag which matches the opening tag (without / )
 
Upvote 0
Code:
Sub XL_Test()
Dim myXLApp As Excel.Application
Dim myXLWB As Excel.Workbook
On Error Resume Next
Set myXLApp = GetObject(, "Excel.Application")
If myXLApp Is Nothing Then 'No instance of Excel is available
Set myXLApp = CreateObject("Excel.Application")
End If
Workbooks.Open "C:\Users\Joe\Desktop\R-MailJoe.xlsm"
End Sub/[code]
 
still testing
 
Upvote 0
After the [ and in front of code
 
Upvote 0
Code:
Sub XL_Test()
Dim myXLApp As Excel.Application
Dim myXLWB As Excel.Workbook
On Error Resume Next
Set myXLApp = GetObject(, "Excel.Application")
If myXLApp Is Nothing Then 'No instance of Excel is available
Set myXLApp = CreateObject("Excel.Application")
End If
Workbooks.Open "C:\Users\Joe\Desktop\R-MailJoe.xlsm"
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,615
Messages
6,125,857
Members
449,266
Latest member
davinroach

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