Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Mid function compile error

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Mid function compile error

Dim pos as Long
--
Gary''s Student - gsnu200857


"ojv" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Mid function compile error

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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ojv" wrote in message
...
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 82
Default Mid function compile error

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

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.

On 19 June, 15:48, ojv wrote:
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Mid function compile error

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
"ojv" wrote in message
...
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default Mid function compile error

ty

"Tim Zych" wrote:

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
"ojv" wrote in message
...
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




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 806
Default Mid function compile error

On 19 Jun., 19:50, "Tim Zych" <tzych@nospam at earthlink dot net
wrote:
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 Zychhttp://www.higherdata.com

Exactly.

Regards,
Bernd
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
compile error with Mid() function jc Excel Programming 7 August 4th 08 11:12 AM
Compile error on VBA Function MSweetG222 Excel Programming 13 November 3rd 06 04:09 AM
mid function causes a compile error Brotherwarren Excel Programming 3 October 9th 06 06:21 PM
mid function causes a compile error Brotherwarren Excel Programming 1 October 9th 06 06:06 PM
Help With - Compile Error: Sub or Function Not Defined MWS Excel Programming 2 March 23rd 06 06:51 PM


All times are GMT +1. The time now is 05:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"