Consulting

Results 1 to 1 of 1

Thread: Axiovision - vba script to automate opening files and performing operation on them

  1. #1

    Axiovision - vba script to automate opening files and performing operation on them

    Hi folks,

    Axiovision is a software that's written in VBA, which allows users to operate on images generated by certain microscopes. These images have the .zvi file extension.

    I am trying to write a script in VBA to check all subfolders in a folder, open a particular image in each subfolder, perform a series on operations on the image (which is a macro recorded in Axiovision assigned the key "F9"), then move on to the next subfolder.

    The code I have written so far runs, but unexpectedly stops by placing a breakpoint on a random part of the inner loop. The code is as follows:


    Sub loopThroughFolders()
    Dim basePath, fileSearch, subFolders, fileName, shellCommand, folderPathString, filePathString, filePath as String
    basePath = "F:\Petrography Images"
    fileSearch = "*Mosaix.zvi"
    subFolders = Dir(basePath, vbDirectory)
    Do While subFolders <> ""
    If subFolders <> "." And subFolders <> ".." Then
    folderString = basePath & subFolders
    If GetAttr(folderPathString) = vbDirectory Then
    filePathString = folderPathString & "" & fileSearch
    fileName = Dir(filePathString, vbDirectory)
    filePath = folderPathString & "" & fileName
    shellCommand = "Explorer.exe " & filePathSendKeys "{F9}"
    End If
    End If
    subFolders = Dir()
    Loop
    End Sub
    [/QUOTE]

    Any ideas where I'm going wrong please? Any help would be much appreciated!
    Last edited by Aussiebear; 12-31-2024 at 04:00 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •