Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removal of Default VBA Reference

Status
Not open for further replies.

xvh

Technical User
Aug 1, 2004
8
GB
I have written a set of codes for MSProject which aid in producing a price build up for work based on the programme created. The code works fine, however it is being used across different verions of MSProject, from 98 to 2003. Due to the MSProject Object library, once the project has been saved in one version then it can only be opened by that version or newer.

As is well known, this is not a problem if the reference is for anything other than the default (core application) reference as it can just be automatically replaced if missing with some straight forward code. However, the reference cannot be removed and replaced if it is a default..being met with the error '...reference; in use'.

Ideally, the same version should be put in place for all users but this is not going to happen!

Even more annoying...when you save as Project 98 from newer versions it does not address this problem!

Although this example is concerned with MSProject, I have experienced this problem within other Microsoft Applications.

Does anyone know of how I can remove this bogus reference when opening in an older version of MSProject? Is there a way to remove the reference from outside the application?
 
This code is an example for an excel workbook...
Before the user saves the workbook, the macro changes the file format to the lowest version anticipated, in this case excel 95

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If ActiveWorkbook.FileFormat <> xlExcel5 Then
ActiveWorkbook.SaveAs FileFormat:=xlExcel5
Else
End If
End Sub

maybe you can leverage this for other MS Apps....
 
Thanks for the example.

I have tried the method using a similar code for MSProject saving as 98 file format. However the VB code reference to Microsoft Project 10.0 Object Library (2002) is not being removed or adjusted. Hence when opened by another computer with Project 98 the user recieves the error 'Can't find Project or Library'.

Now I have both 98 and 2002 installed on my computer and I can open the saved file...as I have the necessary dll..and if I compile the project in 98 then it will work for everybody. The problem is I simply can't do this for the amount of people now using the project file.

Thanks all the same for your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top