Solved

How do I open an .xls file in 64-bit version of excel without it being in protected view?

Posted on 2014-11-17
4
352 Views
Last Modified: 2014-11-17
Hello,

I recently upgraded my excel version from 32-bit to 64-bit. I currently use a spreadsheet that runs a macro that saves a file received via email each day to a local folder and then open it up for use. In the 32-bit my VB coding worked without any issue. Now however when I run the code I get the following error message:

Run-time error

Office has detected a problem with this file. To help protect your computer this file cannot be opened.

I have to manually go into the directory, open the file and enable it to be opened in edit view.

Below is the current code

Public Sub GetAttachments_CURE()
Dim FileName As String
 Dim i As Integer
 Dim timestamp As Date
 Dim filecheck As Boolean
 Dim ASK As String
 Dim TRYBOOK As String
 Dim Txt As String
 Dim Itemcheck As Object
 
 TRYBOOK = ActiveWorkbook.Name
 
 filecheck = False
 Set Itemcheck = Nothing
 Set olkAPp = CreateObject("outlook.application")
 Set ns = olkAPp.GetNamespace("MAPI")
 Set Inbox = olkAPp.Session.Folders("London MO - Rates").Folders("Inbox")
 i = 0
 
 If Inbox.Items.Count = 0 Then
    MsgBox "There are no messages in the Inbox.", vbInformation, "Nothing Found"
    Exit Sub
 End If
 
 For Each Item In Inbox.Items
 
   For Each Atmt In Item.Attachments
     If Left(Atmt, 7) <> "Picture" And Left(Atmt, 5) <> "image" Then
        If LCase(Atmt.FileName) Like "*.xls*" Then
           If Atmt.FileName = "MO_London_Rates.xls" Then
                If Dir("C:\Temp\CURE.xls") <> "" Then
                   Kill "C:\Temp\CURE.xls"
                End If
                FileName = "C:\Temp\CURE.xls"
                Atmt.SaveAsFile FileName
                Workbooks.Open ("C:\Temp\CURE.xls")
                If Mid(Range("A6").Value, 45, 2) & "/" & Mid(Range("A6").Value, 42, 2) & "/" & Mid(Range("A6").Value, 48, 4) <> Format(Now(), "DD/MM/YYYY") Then
                   MsgBox "The CURE file contains old data!!!", vbOKOnly + vbExclamation, "OLD DATA!!!"
                End If
                Range("A6:F300").Select
                Selection.Copy
                Workbooks(TRYBOOK).Activate
                Sheets("CURE_Flat").Select
                Range("A6").Select
                ActiveSheet.Paste
                ActiveSheet.Calculate
                Exit Sub
           End If
        End If
     End If
   Next Atmt
'Line1:

Next Item
'goto exitSub
 
'GetAttachments_exit:
   Set Atmt = Nothing
   Set Item = Nothing
   Set ns = Nothing
'   GoTo Line1
'GetAttachments_err:
 
'   Resume GetAttachments_exit
'exitSub:
MsgBox "NO CURE FILE PRESENT!!!"

End
End Sub
0
Comment
Question by:f19l
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40447402
Having you Signed the VBA code?

If not, go to SelfCert.exe (on my computer it's in E:\Program Files (x86)\Microsoft Office 2010\Office14\Selfcert.exe, but it may vary on your computer), create a certificate, then in Excel VBA's editor:

Go to Tools - Digital Signature
Click Choose...
Select your signature
Then save your file
0
 

Author Comment

by:f19l
ID: 40447488
Tried that but still getting the same problem.
0
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40447577
How about Trusting the directory:

1. Go to File - Options - Trust Center.
2. Click on Trust Center Settings...
3. Go to Trusted Locations.
4. If the folder is a network location, click "Allow Trusted Locations on my network".
5. Click on Add new location... and add the folder to the locations.
0
 

Author Comment

by:f19l
ID: 40447646
Thanks. That works.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question