Mid function compile error

O

ojv

I have an add-in which works well on my machine.
Running it on another machine I get a compile error with the Mid function
highlighted. Are thee a simple explanation for this?

Sub GetSTGfilesFromProjectFile()
Dim firstLine As Boolean, firstSmp As Boolean, firstPlot As Boolean
Dim fileFilter As String, Title As String, fullFileName As String, file As
String, root As String
Dim saveStatusbar As String, stgFile As String, sheetName As String, errMsg
As String
Dim pos As Integer, fileNumber As Integer, oldSheetsInNewWorkbook As
Integer, i As Integer, posSlash As Integer, posDot As Integer
Dim data, radialP(), words(), stgFiles(), shearingFiles(),
consolidationFiles(), projectInfo(), poreWater()
Dim wb As Workbook
Dim ws As Worksheet
Dim rng As Range, rng2 As Range

fileFilter = "stg files (*.prj),*.prj," & "All files (*.*),*.*"

Title = cGeoData & " Select Project File to Import From..."
fullFileName = Application.GetOpenFilename _
(fileFilter:=fileFilter, _
FilterIndex:=1, _
Title:=Title, _
MultiSelect:=False)
If fullFileName = "" Or fullFileName = "False" Then Exit Sub
pos = InStrRev(fullFileName, "\")
root = Mid(fullFileName, 1, pos)

fileNumber = FreeFile 'FreeFile function
 
D

Don Guillett

Is it possible they are using different versions where instrREV is not
available?
 
N

norie

On the machine/set-up where it's not working take a look under
Tool>References.

Is there anything MISSING?

If there is uncheck it and try the code again.

You might want to check this for all files involved.

If you don't find anything try using VBA.Mid, just as a workaround
though.
 
T

Tim Zych

That is usually a reference problem. Go to Tools -> References on the
compile error machines and identify any MISSING references. They need to be
unchecked on the dev machine, assuming they are not needed.

--
Regards,
Tim Zych
http://www.higherdata.com

Workbook Compare - Excel data comparison utility
 
O

ojv

ty

Tim Zych said:
That is usually a reference problem. Go to Tools -> References on the
compile error machines and identify any MISSING references. They need to be
unchecked on the dev machine, assuming they are not needed.

--
Regards,
Tim Zych
http://www.higherdata.com

Workbook Compare - Excel data comparison utility
 
B

Bernd P

That is usually a reference problem. Go to Tools -> References on the
compile error machines and identify any MISSING references. They need to be
unchecked on the dev machine, assuming they are not needed.
Exactly.

Regards,
Bernd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top