Problems Opening Excel from Outlook

Status
Not open for further replies.

Alan McGowan

Senior Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
I am trying to open an Excel spreadsheet from within Outlook using the code below. It works perfectly if Excel is already running. If Excel is not already open it seems to open Excel (as it appears in task manager) but doesn't open the spreadsheet. Any ideas?

Dim xl As Object
Dim xls As Object
Dim strxls As String
Dim intSection As Integer
Dim intTries As Integer
Dim strFullPathAndFileName As String

' Set full path and filename
strFullPathAndFileName = "C:\filemail\fm_settings.xlsm"

intSection = 1 ''attempting GetObject...
On Error Resume Next
' Try to refer to running instance of Excel
Set xl = GetObject(, "Excel.Application")
xl.Visible = True
' If Excel wasn't running...
If xl Is Nothing Then
' start Excel
Set xl = CreateObject("Excel.Application")
xl.Visible = True
If xl Is Nothing Then
MsgBox "Can't start Excel!", vbExclamation
Exit Sub
End If
End If
On Error GoTo 0
intSection = 0 ''resume normal error handling

' Open text file
Set xls = xl.Workbooks.Open(strFullPathAndFileName)

Set xl = Nothing
 

Alan McGowan

Senior Member
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Sorted. I had to add

xl.Visible = True

after the line of code

Set xls = xl.Workbooks.Open(strFullPathAndFileName)
 

Can

New Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server 2010
Hi,
I want to open 2 excels and copy some rows from one to another. I used this code to open but ı could not manage to open 2 excels. Please help.

Sub excel1(item As Outlook.MailItem)

Dim xlApp As Object
Dim sourceWB
Dim sourceWS
Set xlApp = CreateObject("Excel.Application")
With xlApp
.Visible = True
.EnableEvents = True
End With
strfile = "\\Tcjumbo\cno-rapor\Rapor_098\W-40\CQI_CS_Drop_Hucre_Detay_W40.xlsx" 'Put your file path.
Set sourceWB = xlApp.workbooks.Open(strfile, , False, , , , , , , True)
Set sourceWH = sourceWB.worksheets("Sheet1")
sourceWB.Activate
xlApp.workbooks.Open
End Sub
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
T Problems opening the EMS and EMC - WinRM, Kerberos, Powershell Exchange Server Administration 4
M Problems with opening emails Using Outlook 1
P Re: Outlook 2000 Opening Problems Using Outlook 2
D Re: Problems opening Outlook 2000 Using Outlook 1
S A Possible Solution to Outlook 2000 Opening Problems Using Outlook 1
S Re: Outlook 2000 Opening Problems Using Outlook 2
Z problems opening outlook Using Outlook 2
A Problems opening files Using Outlook 2
M Export-Import .pst file problems Using Outlook 2
V iCloud calendar sync problems Using Outlook 13
T Many problems with outlook.com - will upgrade to Outlook soon Using Outlook 1
cricket1001 Problems with calendar syncing Using Outlook 0
P Syncing problems with add-ins Using Outlook 3
T problems with Contacts Using Outlook 8
P Problems with Standss new Quickfile 6 Using Outlook 3
Q Problems with Autodiscover Outlook 2016 Using Outlook 0
D Outlook 2013 Yahoo IMAP Sync problems Using Outlook 1
M Indexing Problems Outlook 365 Using Outlook 2
M I'm Having problems Moving Contacts to a New List Using Outlook 8
C 2016 Outlook Certificate Problems Outlook VBA and Custom Forms 3
D Archiving Problems Using Outlook 6
M Recent Update Did not Fix Search Problems Using Outlook 7
S Problems syncing emails with webmail after changing to Outlook 2016 Using Outlook 1
crazyboy Problems connecting to BCM on Server Using Outlook 2
J Problems connecting to BCM BCM (Business Contact Manager) 16
O Folder Pane problems Using Outlook 5
M Problems Downloading Content from Server(s) Using Outlook 0
O Outlook 2013 Problems sending large mails Using Outlook 4
Diane Poremsky iCloud and Outlook Problems: Syncing Calendar New Slipstick.com Articles 0
G Outlook problems Using Outlook 2
D Calendar view problems with reading pane open Using Outlook 0
A Two Problems with BCM BCM (Business Contact Manager) 0
G Problems with Active Directory Rights Management Services (AD RMS) in Outlook 2013 Exchange Server Administration 0
T Outlook Connector calendar sync problems with Android phone Using Outlook.com accounts in Outlook 1
J Outlook 2010 sync problems with Outlook Connector Using Outlook 1
B Outlook being closed causing problems during copy to Excel Outlook VBA and Custom Forms 6
A Problems with Outlook Connector in Outlook 2010 Using Outlook 2
V Please help if you can. Problems with Bcc BCM (Business Contact Manager) 3
J problems downloading POP3 emails to Outlook 2003 Using Outlook 1
THOMAS BRAXTON Microsoft Office 2010 problems Using Outlook 1
tswatek Inbox problems after adding MS Exchange email Using Outlook 2
B two unrelated problems Using Outlook 2
Felix Deleted emails sync problems Using Outlook.com accounts in Outlook 1
H Problems With Outlook 2013 VBA To Send and Print an email Outlook VBA and Custom Forms 1
L Outlook 2013 setup problems Exchange Server Administration 1
T Outlook 2013 and outlook.com sync problems Using Outlook 5
R Outlook 2013 email folder sync problems using OneDrive Using Outlook 3
Tim King Message body problems Using Outlook 3
M Outlook problems after yesterday's update Using Outlook 4
Jon Bakrley problems with outlook 2013 and pst files Using Outlook 4
Similar threads


















































Top