Diffuculties with compatibility

dermitdenaces

New Member
Joined
Apr 5, 2021
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi,

i am having some problems with a project im working on. For me the project is working fine. But when I send it to a colleauge it wont work for him, he is using an older version of excel.
Im pretty sure the problem is that im using microsoft 16.0 Object library and he is using the old 15.0 version. I read online that late binding should fix this. I tried to late bind everything but im still getting errors. Help would be greatly aprreaciated.

The function left is throwing an error (cant find project or libarary). If we check in tools references the libarys are not marked as missing.
 
Last edited by a moderator:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Sub Send_Mail_Esk()

Dim emailApplication As Object
Dim emailItem As Object
Dim strPath As String
Dim lngPos As Long

Dim test As Object


strPath = ActiveWorkbook.FullName
lngPos = InStrRev(strPath, ".")
strPath = Left(strPath, lngPos) & "pdf"

Dim activerow As Long
activerow = ActiveCell.Row
ActiveSheet.Unprotect "****"
'Copies Cells for Printing to bottom of cell
ActiveSheet.Range(("B3:N8") & ",B" & activerow & ":N" & activerow).Copy Sheets("Model").Range("B212:M221")

ActiveSheet.PageSetup.PrintArea = "B212:N221"

ActiveSheet.PageSetup.Orientation = 2
ActiveSheet.PageSetup.Zoom = False
ActiveSheet.PageSetup.FitToPagesWide = 1
ActiveSheet.PageSetup.FitToPagesTall = 1

ActiveSheet.ExportAsFixedFormat xlTypePDF, strPath

Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItem(0)

emailItem.To = Range("AD" & activerow).Value
emailItem.Subject = Range("AE" & activerow).Value
emailItem.HTMLBody = Range("AF" & activerow).Value
emailItem.Attachments.Add strPath
emailItem.Display

Set emailItem = Nothing
Set emailApplication = Nothing

'Deletes All Copied Cells and Pictures from previous copy

Sheets("Model").Range("B212:N221").Delete
Dim pic As Picture
For Each pic In ActiveSheet.Pictures
If Not Application.Intersect(pic.TopLeftCell, Range("B208:N221")) Is Nothing Then
pic.Delete
End If
Next pic
ActiveSheet.Protect "*****"

' Delete the PDF file (not nesecarry) keep most recent updated send file




End Sub
 
Upvote 0
Welcome to the Board!

Are you saying that the "LEFT" function is causing you issues? The LEFT function has been around for ages, and the older versions should not have any issue with it.
If you compare the VBA References, do you have all the same ones checked (the version numbers might be slightly different, but the names should all be essentially the same - make sure you aren't missing any)!

Also, what version of office is this other user using?

And which line of code is returning the error, and what exactly does the error message say?
 
Upvote 0
The message translates to: Error when comiling: Project or Libary not found.
 

Attachments

  • Screenshot_of_sheet.png
    Screenshot_of_sheet.png
    130.1 KB · Views: 18
Upvote 0
The rest of the questions I will need to come back with, but thanks for helping already!
 
Upvote 0
I agree 1000% Left is not the problem. Having said that, you can verify by trying strPath = Mid(strPath, 1, lngPos) & "pdf"
you can also try msgbox (left("Helloworld",5))
I have a feeling lngPos has bad value.
you have to check
if lngPos > 0 then
strpath=left(strpath,lngpos)
else
msgbox ("error")
end if
 
Last edited:
Upvote 0
@jsb1921 The fact that the OP is getting a compile error, means the code has not run & therefore lngPos is irrelevant.

@dermitdenaces do you get the same error if you use
VBA Code:
strPath = VBA.Left(strPath, lngPos) & "pdf"
 
Upvote 0
Solution
Thanks for your help. The VBA solved the problem. Could you explain why this is sometimes needed?
 
Upvote 0
Could you explain why this is sometimes needed?
Fraid not. It's not something I've ever had to use, but I have seen other threads on here where adding the VBA. has removed the problem.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

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