Problem to run

HuaMin Chen
HuaMin Chen used Ask the Experts™
on
Hi,
When running the macro below

Sub AA_Validate_Path_vgm()
    Dim Obj0 As Object, Source0 As Object, File0 As Variant, File1 As String, File2 As String, Pos0 As Integer, Pos1 As Integer, Pos2 As Integer, Pos3 As Integer, iFile As Integer, TextLine As String, Str0 As String, Command0 As String, FSO As Object, Path0 As String, Message0 As String
        
    Set FSO = CreateObject("scripting.filesystemobject")
    File0 = Dir("C:\cmp3g\CODECO_ERROR_0\*.*", 7)
    Do While (File0 <> "" And UCase(File0) <> "ERROR.TXT")
        'Debug.Print File0
        File1 = "C:\cmp3g\CODECO_ERROR_0\" & File0
        iFile = FreeFile
        Open File1 For Input As #iFile
        Do Until EOF(1)
            Line Input #1, TextLine
            
            If Trim(TextLine) <> "" Then
            Pos0 = InStr(TextLine, "UNOA")
            If (Pos0 > 0) Then
                Pos1 = InStr(Pos0 + 1, TextLine, "+")
                Pos2 = InStr(Pos1 + 1, TextLine, "+")
                Pos3 = InStr(Pos1 + 1, TextLine, ":")
                
                If Pos3 < Pos2 Then
                    Pos2 = Pos3
                End If
                
                Message0 = ""
                Str0 = Mid(TextLine, Pos1 + 1, Pos2 - 1 - Pos1)
                'Debug.Print Str0
                If Len(Str0) > 0 Then
                    'Path0 = "C:\cmp3g\CODECO_ERROR_0\" & Str0 & "\"
                    
                    'If FSO.FolderExists(Path0) = False Then
                        'Command0 = "cmd /c mkdir """ & Path0 & """ "
                        'Shell (Command0)
                        'MkDir (Path0)
                        
                        'DoEvents
                        'Application.Wait Now + TimeValue("00:00:07")
                        
                    'End If
                
                    If UCase(File0) <> "ERROR.TXT" Then
                        'Command0 = "cmd /c copy /y ""C:\cmp3g\CODECO_ERROR_0\" & File0 & """ ""C:\cmp3g\CODECO_ERROR_0\" & Str0 & """ "
                        'Shell (Command0)
                    
                        'FileCopy "C:\cmp3g\CODECO_ERROR_0\" & File0  "C:\cmp3g\CODECO_ERROR_0\" & Str0
                        'Debug.Print File0 & " x1 " & Str0
                        'Debug.Print File2 & " x2 " & Str0
                        'DoEvents
                        'Application.Wait Now + TimeValue("00:00:07")
                        
                        File2 = File0
                        'Validate_File Str0, File0, Message0
                        Shell ("C:\cmp3g\CODECO_ERROR_0\Validate_File1 """ & Str0 & """ """ & File2 & """")
                    End If
                    
                    Exit Do
                End If
                
            End If
            End If
        Loop
        Close #iFile
        
        File0 = Dir
    Loop
End Sub

Open in new window

within LibreOffice 5.1.2, I get nothing happened, while in Excel 2010, everything is fine.

why?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
For one thing - does that file path exist on your machine?
HuaMin ChenProblem resolver

Author

Commented:
Yes, all are existing inside the machine.
NorieAnalyst Assistant

Commented:
Are you sure LibreOffice can run that code?

Macros in MS Office and LibreOffice.
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:
For what it's worth, the macro code on this page http://www.debugpoint.com/2014/09/writing-a-macro-in-libreoffice-calc-getting-started/ runs in LibreOffice.
HuaMin ChenProblem resolver

Author

Commented:
I want to know how we can ensure the workable codes in MS office can also "move" within LibreOffice.
Dave BaldwinFixer of Problems
Most Valuable Expert 2014
Commented:
You probably can't.  It appears that LibreOffice Basic and MS VBA are two different languages.  And it appears that LibreOffice Basic requires a JAVA runtime to execute macros.
HuaMin ChenProblem resolver

Author

Commented:
It means LibreOffice does not "fully" support Excel functionalities.
HuaMin ChenProblem resolver

Author

Commented:
Or can I say, since LibreOffice does NOT have VBA/VB script to CALC at all?
Fixer of Problems
Most Valuable Expert 2014
Commented:
LibreOffice has LibreOffice Basic which requires a JAVA runtime.  It does NOT have VBA/VB script despite the similarities in the macro code.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial