?
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
Medium Priority
?
383 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

777 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