VBA stopped working through Sharepoint

jon1315

Board Regular
Joined
Jun 16, 2020
Messages
60
Office Version
  1. 365
Platform
  1. Windows
Good morning
I'm looking to move my files into Sharepoint, some of which contain macros.

I did some initial testing in October (where I created a simple "add timestamp to sheet2") and it looked to work fine (opening the file in desktop version, running the vba, then saving the file) but in revisiting it now I get the following error:

Compile error: can't find project or library


This looks to hit every variable. When I declare my variables with dim, the error won't occur, but I get the error on functions like Format, which I'm unable to declare.

Example code below:

VBA Code:
Sub test1()
output.Select
lrow = Cells(Rows.Count, 1).End(xlUp).Row
Range("a" & lrow + 1).Value = Format(Now(), "DDMMYY HH:MM:SS")

    Sheets("output").Copy

    Dim SharePointURL As String
    Dim FileName As String
    
    SharePointURL = "https://sharepoint.com/sites/AutomationTest/Shared%20Documents/Test%20macro%20environment/Outputs%20sent%20to%20here/"
    FileName = "test output copy.xlsx"
    ActiveWorkbook.SaveAs SharePointURL & FileName

    ActiveWorkbook.Close SaveChanges:=False
    
    Instructions.Select
    MsgBox "Macro completed"
    Exit Sub
    
End Sub


Has anyone else experienced this? I'm struggling with ideas on how to fix!

Thank you in advance
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Sorry - just to add - the code example isn't the cleanest I've just added things in different ways to see if anything will be able to push through the error but so far unable to find anything!
 
Upvote 0
Check Tools - References in the VB Editor with that workbook open and active. One of the ticked items will be prefixed with 'MISSING:'
 
Upvote 1
Solution
Afternoon Rory
Thank you for the quick response. You're right - and I did see this the other day but it completely slipped my mind.

What's the way to go with this? Should I be unticking it, or will I have to find the missing one and add it back in? If I do need to add it back in, how would I go about doing this?

Thank you
Jon
 
Upvote 0
It depends what it is. If you are using it in the code, then you will have to try and locate the correct library; otherwise you can simply uncheck it.
 
Upvote 0
Thank you Rory, appreciate it.
I'll have a look & see if I can figure it out!
 
Upvote 0
The missing library was NucleusNativeMessagingLib. I haven't seen it before, and it wasn't on my original file pre Sharepoint.
I've turned it off, and all looks to work fine, thank you!

I'm just wondering - what is that library? Will turning it off have any impact? What would cause it to be missing, is it something that could happen again?
 
Upvote 0
Unless you are using it in your code, you don't need the reference. I have no idea what it is.
 
Upvote 0

Forum statistics

Threads
1,215,095
Messages
6,123,073
Members
449,093
Latest member
ripvw

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