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
317 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
  • 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now