Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
Hi All,
I have got some code that interfaces between an application and excel. It processes files for a version managing system - I am encountering a problem when handling file names with parenthesis. E.g. If I put the following in a cell =InterfaceMacro(Process Detail.doc) works whereas =InterfaceMacro(Process Detail(s).doc) does not work. I have spoken to the support team for the version managing system and they say their software can handly parenthesis (I am almost certain they are correct). This leads me to believe that this is a possible limitation of vba? Is there anyway I can get round this as I can't change my file names. Thanks in advance Andi |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
Andi,
This works for me: Function InterfaceMacro(FileName As String) MsgBox FileName End Function =InterfaceMacro("Process Detail(s).doc") =InterfaceMacro("Process Detail.doc") HTH "Andibevan" wrote: Hi All, I have got some code that interfaces between an application and excel. It processes files for a version managing system - I am encountering a problem when handling file names with parenthesis. E.g. If I put the following in a cell =InterfaceMacro(Process Detail.doc) works whereas =InterfaceMacro(Process Detail(s).doc) does not work. I have spoken to the support team for the version managing system and they say their software can handly parenthesis (I am almost certain they are correct). This leads me to believe that this is a possible limitation of vba? Is there anyway I can get round this as I can't change my file names. Thanks in advance Andi |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
Toppers - I realise your example works - Essentially the macro's I am using
pass the information (filename and path) to an external application. The external application then processes the file. It works fine except for files without parenthysis but not with - I was wondering if this could be attributed to any limitations of VBA? "Toppers" wrote in message ... Andi, This works for me: Function InterfaceMacro(FileName As String) MsgBox FileName End Function =InterfaceMacro("Process Detail(s).doc") =InterfaceMacro("Process Detail.doc") HTH "Andibevan" wrote: Hi All, I have got some code that interfaces between an application and excel. It processes files for a version managing system - I am encountering a problem when handling file names with parenthesis. E.g. If I put the following in a cell =InterfaceMacro(Process Detail.doc) works whereas =InterfaceMacro(Process Detail(s).doc) does not work. I have spoken to the support team for the version managing system and they say their software can handly parenthesis (I am almost certain they are correct). This leads me to believe that this is a possible limitation of vba? Is there anyway I can get round this as I can't change my file names. Thanks in advance Andi |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
I have no idea what InterfaceMacro does, so this is a bit of a shot, but
how about =InterfaceMacro('Process Detail(s).doc') -- HTH RP (remove nothere from the email address if mailing direct) "Andibevan" wrote in message ... Hi All, I have got some code that interfaces between an application and excel. It processes files for a version managing system - I am encountering a problem when handling file names with parenthesis. E.g. If I put the following in a cell =InterfaceMacro(Process Detail.doc) works whereas =InterfaceMacro(Process Detail(s).doc) does not work. I have spoken to the support team for the version managing system and they say their software can handly parenthesis (I am almost certain they are correct). This leads me to believe that this is a possible limitation of vba? Is there anyway I can get round this as I can't change my file names. Thanks in advance Andi |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
Andi,
If I try =InterfaceMacro(Process Details.doc) i.e. not in quotes, I get an error BUT if I put Procees Detail.doc (no quotation marks) in a cell e.g B1 and then =InterfaceMacro(B1) it works for this and Procces Detail(s).doc using my function previously defined. Don't know if this helps any. "Andibevan" wrote: Toppers - I realise your example works - Essentially the macro's I am using pass the information (filename and path) to an external application. The external application then processes the file. It works fine except for files without parenthysis but not with - I was wondering if this could be attributed to any limitations of VBA? "Toppers" wrote in message ... Andi, This works for me: Function InterfaceMacro(FileName As String) MsgBox FileName End Function =InterfaceMacro("Process Detail(s).doc") =InterfaceMacro("Process Detail.doc") HTH "Andibevan" wrote: Hi All, I have got some code that interfaces between an application and excel. It processes files for a version managing system - I am encountering a problem when handling file names with parenthesis. E.g. If I put the following in a cell =InterfaceMacro(Process Detail.doc) works whereas =InterfaceMacro(Process Detail(s).doc) does not work. I have spoken to the support team for the version managing system and they say their software can handly parenthesis (I am almost certain they are correct). This leads me to believe that this is a possible limitation of vba? Is there anyway I can get round this as I can't change my file names. Thanks in advance Andi |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
Thanks for the suggestion - I may have complicated things by trying to
simplify my example. The File paths are stored in excel and then use the function to extract the required info about the file:- e.g. Cell a1 = "Process Details.doc" Cell b1 = InterfaceMacro(a1) Cell a2 = "Process Detail(s).doc" cellb1 = InterfaceMacro(b1) I am essentially grabbing at straws as I know what is causing the error in my program (parenthesys in the filename) but I am unsure of the root cause. In my example above row 1 will work, row 2 will not "Toppers" wrote in message ... Andi, If I try =InterfaceMacro(Process Details.doc) i.e. not in quotes, I get an error BUT if I put Procees Detail.doc (no quotation marks) in a cell e.g B1 and then =InterfaceMacro(B1) it works for this and Procces Detail(s).doc using my function previously defined. Don't know if this helps any. "Andibevan" wrote: Toppers - I realise your example works - Essentially the macro's I am using pass the information (filename and path) to an external application. The external application then processes the file. It works fine except for files without parenthysis but not with - I was wondering if this could be attributed to any limitations of VBA? "Toppers" wrote in message ... Andi, This works for me: Function InterfaceMacro(FileName As String) MsgBox FileName End Function =InterfaceMacro("Process Detail(s).doc") =InterfaceMacro("Process Detail.doc") HTH "Andibevan" wrote: Hi All, I have got some code that interfaces between an application and excel. It processes files for a version managing system - I am encountering a problem when handling file names with parenthesis. E.g. If I put the following in a cell =InterfaceMacro(Process Detail.doc) works whereas =InterfaceMacro(Process Detail(s).doc) does not work. I have spoken to the support team for the version managing system and they say their software can handly parenthesis (I am almost certain they are correct). This leads me to believe that this is a possible limitation of vba? Is there anyway I can get round this as I can't change my file names. Thanks in advance Andi |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
Can you post the code for InterfaceMacro so we can try see what the problem is?
Using a Subroutine (not Function) I could open a file "Process Detail(s).xls" OK so it's difficult to see where your problem lies. "Andibevan" wrote: Thanks for the suggestion - I may have complicated things by trying to simplify my example. The File paths are stored in excel and then use the function to extract the required info about the file:- e.g. Cell a1 = "Process Details.doc" Cell b1 = InterfaceMacro(a1) Cell a2 = "Process Detail(s).doc" cellb1 = InterfaceMacro(b1) I am essentially grabbing at straws as I know what is causing the error in my program (parenthesys in the filename) but I am unsure of the root cause. In my example above row 1 will work, row 2 will not "Toppers" wrote in message ... Andi, If I try =InterfaceMacro(Process Details.doc) i.e. not in quotes, I get an error BUT if I put Procees Detail.doc (no quotation marks) in a cell e.g B1 and then =InterfaceMacro(B1) it works for this and Procces Detail(s).doc using my function previously defined. Don't know if this helps any. "Andibevan" wrote: Toppers - I realise your example works - Essentially the macro's I am using pass the information (filename and path) to an external application. The external application then processes the file. It works fine except for files without parenthysis but not with - I was wondering if this could be attributed to any limitations of VBA? "Toppers" wrote in message ... Andi, This works for me: Function InterfaceMacro(FileName As String) MsgBox FileName End Function =InterfaceMacro("Process Detail(s).doc") =InterfaceMacro("Process Detail.doc") HTH "Andibevan" wrote: Hi All, I have got some code that interfaces between an application and excel. It processes files for a version managing system - I am encountering a problem when handling file names with parenthesis. E.g. If I put the following in a cell =InterfaceMacro(Process Detail.doc) works whereas =InterfaceMacro(Process Detail(s).doc) does not work. I have spoken to the support team for the version managing system and they say their software can handly parenthesis (I am almost certain they are correct). This leads me to believe that this is a possible limitation of vba? Is there anyway I can get round this as I can't change my file names. Thanks in advance Andi |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
No problem:-
The line that causes a problem is:- status = PvcsOpenArchive(ByVal SelectedFile, ByVal workfile, ByVal Len(workfile), ByVal archive, ByVal Len(archive), PVCS_OPEN_RDONLY, handle) Function GetRevisionInfo(SelectedFile As String) Dim handle As Long ' Handle for the archive to be opened Dim workfile As String * 256 ' Workfile Dim archive As String * 256 ' Archive Dim status As Integer ' Status returned from the DTK function Dim revision As String ' Revision number Dim branch_count As Long ' Number of branches Dim lock_count As Long ' Number of locks Dim level As Long ' Revision level Dim checkin_date As String * 35 ' Date revision was checked in Dim modify_date As String * 35 ' Date revision was modified Dim ordinal As Long ' Ordinal number Dim receive_revision As String * 35 ' Revision number that was looked at by the function Dim revision_index As Long ' Revision index number Dim flags As Long ' Flags Dim txtQueryResults As String, txtOpenResults As String ' Status indicators Dim txtInfoResults As String, txtCloseResults As String ' Status indicators ' Initialize configuration settings status = PvcsQueryConfiguration(ByVal 0&, ByVal 0&, 0, PVCS_CONFIG_OVERWRITE) txtQueryResults = status ' Open archive for read-only access status = PvcsOpenArchive(ByVal SelectedFile, ByVal workfile, ByVal Len(workfile), ByVal archive, ByVal Len(archive), PVCS_OPEN_RDONLY, handle) txtOpenResults = status ' Get information about the revision ' Archive handle ' Name of the archive or workfile ' Revision to retieve information about ' Buffer receiving number of brances off this revision ' Buffer receiving number of locks on this revision ' Buffer receiving revision level ' Buffer receiving name of archive owner ' Buffer receiving the date that the revision was checked in ' Buffer receiving the date that the revision was modified ' Buffer receiving the ordinal number ' Buffer receiving the revision number ' Revision information structure about which to return information ' Flags ' revision = "1.3" ' This can be a revision number, label, or promotion group status = PvcsGetRevisionInfoVB(ByVal handle, ByVal SelectedFile, ByVal revision, _ branch_count, lock_count, level, ByVal checkin_date, ByVal modify_date, _ ordinal, ByVal receive_revision, ByVal revision_index, PVCS_REVINFO_USE_DATETIME_FORMAT) txtInfoResults = status 'txtArchive = SelectedFile 'txtRevisionNbr = revision 'If status = 0 Then ' Display the output 'txtNbrBranches = branch_count 'txtNbrLock = lock_count 'txtRevLevel = level 'txtCheckInDate = checkin_date 'txtModDate = modify_date 'txtOrdinal = ordinal 'txtRevisionGot = receive_revision 'txtRevIndex = revision_index 'End If GetRevisionInfo = receive_revision ' Close archive status = PvcsCloseArchive(handle) ' Pass in the handle to the archive txtCloseResults = status End Function |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
Andi,
Obviously I can't test as I don't have PVCS but looking at your code, and the fact that the filename is passed as a string, would suggest to me that the problem DOES lie with PVCS. All the testing I have done has worked with Excel VBA quite happily. Is it worth changing the "error" statement to add "as String" to SelectedFile declaration. It wouldn't appear necessary but I have run out of ideas. Sorry I can't be of more help. status = PvcsOpenArchive(ByVal SelectedFile as String, ByVal workfile, ByVal Len(workfile), ByVal archive, ByVal Len(archive), PVCS_OPEN_RDONLY, handle) "Andibevan" wrote: No problem:- The line that causes a problem is:- status = PvcsOpenArchive(ByVal SelectedFile, ByVal workfile, ByVal Len(workfile), ByVal archive, ByVal Len(archive), PVCS_OPEN_RDONLY, handle) Function GetRevisionInfo(SelectedFile As String) Dim handle As Long ' Handle for the archive to be opened Dim workfile As String * 256 ' Workfile Dim archive As String * 256 ' Archive Dim status As Integer ' Status returned from the DTK function Dim revision As String ' Revision number Dim branch_count As Long ' Number of branches Dim lock_count As Long ' Number of locks Dim level As Long ' Revision level Dim checkin_date As String * 35 ' Date revision was checked in Dim modify_date As String * 35 ' Date revision was modified Dim ordinal As Long ' Ordinal number Dim receive_revision As String * 35 ' Revision number that was looked at by the function Dim revision_index As Long ' Revision index number Dim flags As Long ' Flags Dim txtQueryResults As String, txtOpenResults As String ' Status indicators Dim txtInfoResults As String, txtCloseResults As String ' Status indicators ' Initialize configuration settings status = PvcsQueryConfiguration(ByVal 0&, ByVal 0&, 0, PVCS_CONFIG_OVERWRITE) txtQueryResults = status ' Open archive for read-only access status = PvcsOpenArchive(ByVal SelectedFile, ByVal workfile, ByVal Len(workfile), ByVal archive, ByVal Len(archive), PVCS_OPEN_RDONLY, handle) txtOpenResults = status ' Get information about the revision ' Archive handle ' Name of the archive or workfile ' Revision to retieve information about ' Buffer receiving number of brances off this revision ' Buffer receiving number of locks on this revision ' Buffer receiving revision level ' Buffer receiving name of archive owner ' Buffer receiving the date that the revision was checked in ' Buffer receiving the date that the revision was modified ' Buffer receiving the ordinal number ' Buffer receiving the revision number ' Revision information structure about which to return information ' Flags ' revision = "1.3" ' This can be a revision number, label, or promotion group status = PvcsGetRevisionInfoVB(ByVal handle, ByVal SelectedFile, ByVal revision, _ branch_count, lock_count, level, ByVal checkin_date, ByVal modify_date, _ ordinal, ByVal receive_revision, ByVal revision_index, PVCS_REVINFO_USE_DATETIME_FORMAT) txtInfoResults = status 'txtArchive = SelectedFile 'txtRevisionNbr = revision 'If status = 0 Then ' Display the output 'txtNbrBranches = branch_count 'txtNbrLock = lock_count 'txtRevLevel = level 'txtCheckInDate = checkin_date 'txtModDate = modify_date 'txtOrdinal = ordinal 'txtRevisionGot = receive_revision 'txtRevIndex = revision_index 'End If GetRevisionInfo = receive_revision ' Close archive status = PvcsCloseArchive(handle) ' Pass in the handle to the archive txtCloseResults = status End Function |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Use Parenthesis in Filenames - workaround??
Toppers - Thanks for your assistance - it is difficult as the PVCS support
said this is not a problem (I agree with you and believe the problem is with PVCS). Thanks again. Andi "Toppers" wrote in message ... Andi, Obviously I can't test as I don't have PVCS but looking at your code, and the fact that the filename is passed as a string, would suggest to me that the problem DOES lie with PVCS. All the testing I have done has worked with Excel VBA quite happily. Is it worth changing the "error" statement to add "as String" to SelectedFile declaration. It wouldn't appear necessary but I have run out of ideas. Sorry I can't be of more help. status = PvcsOpenArchive(ByVal SelectedFile as String, ByVal workfile, ByVal Len(workfile), ByVal archive, ByVal Len(archive), PVCS_OPEN_RDONLY, handle) "Andibevan" wrote: No problem:- The line that causes a problem is:- status = PvcsOpenArchive(ByVal SelectedFile, ByVal workfile, ByVal Len(workfile), ByVal archive, ByVal Len(archive), PVCS_OPEN_RDONLY, handle) Function GetRevisionInfo(SelectedFile As String) Dim handle As Long ' Handle for the archive to be opened Dim workfile As String * 256 ' Workfile Dim archive As String * 256 ' Archive Dim status As Integer ' Status returned from the DTK function Dim revision As String ' Revision number Dim branch_count As Long ' Number of branches Dim lock_count As Long ' Number of locks Dim level As Long ' Revision level Dim checkin_date As String * 35 ' Date revision was checked in Dim modify_date As String * 35 ' Date revision was modified Dim ordinal As Long ' Ordinal number Dim receive_revision As String * 35 ' Revision number that was looked at by the function Dim revision_index As Long ' Revision index number Dim flags As Long ' Flags Dim txtQueryResults As String, txtOpenResults As String ' Status indicators Dim txtInfoResults As String, txtCloseResults As String ' Status indicators ' Initialize configuration settings status = PvcsQueryConfiguration(ByVal 0&, ByVal 0&, 0, PVCS_CONFIG_OVERWRITE) txtQueryResults = status ' Open archive for read-only access status = PvcsOpenArchive(ByVal SelectedFile, ByVal workfile, ByVal Len(workfile), ByVal archive, ByVal Len(archive), PVCS_OPEN_RDONLY, handle) txtOpenResults = status ' Get information about the revision ' Archive handle ' Name of the archive or workfile ' Revision to retieve information about ' Buffer receiving number of brances off this revision ' Buffer receiving number of locks on this revision ' Buffer receiving revision level ' Buffer receiving name of archive owner ' Buffer receiving the date that the revision was checked in ' Buffer receiving the date that the revision was modified ' Buffer receiving the ordinal number ' Buffer receiving the revision number ' Revision information structure about which to return information ' Flags ' revision = "1.3" ' This can be a revision number, label, or promotion group status = PvcsGetRevisionInfoVB(ByVal handle, ByVal SelectedFile, ByVal revision, _ branch_count, lock_count, level, ByVal checkin_date, ByVal modify_date, _ ordinal, ByVal receive_revision, ByVal revision_index, PVCS_REVINFO_USE_DATETIME_FORMAT) txtInfoResults = status 'txtArchive = SelectedFile 'txtRevisionNbr = revision 'If status = 0 Then ' Display the output 'txtNbrBranches = branch_count 'txtNbrLock = lock_count 'txtRevLevel = level 'txtCheckInDate = checkin_date 'txtModDate = modify_date 'txtOrdinal = ordinal 'txtRevisionGot = receive_revision 'txtRevIndex = revision_index 'End If GetRevisionInfo = receive_revision ' Close archive status = PvcsCloseArchive(handle) ' Pass in the handle to the archive txtCloseResults = status End Function |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MISSING PARENTHESIS | Excel Worksheet Functions | |||
parenthesis | Excel Discussion (Misc queries) | |||
Parenthesis problem | Charts and Charting in Excel | |||
WHAT ARE PARENTHESIS IN FORMULAS? | New Users to Excel | |||
Parenthesis - to use or not to use? | Excel Programming |