![]() |
|
#2
|
||||
|
||||
|
It is odd that Visio doesn't allow the usual vba file picker dialogs.
The first solution posted by PatricK in this thread works for my 32bit Visio and someone posted that it worked on a 64 bit version too. vba - VBScript to open a dialog to select a filepath - Stack Overflow Using that code I adapted it to test Code:
Sub VisioFilePicker()
Dim wShell As Object, sPath As String, oExec As Variant
Set wShell = CreateObject("WScript.Shell")
Set oExec = wShell.Exec("mshta.exe ""about:<input type=file id=FILE><script>FILE.click();new ActiveXObject('Scripting.FileSystemObject').GetStandardStream(1).WriteLine(FILE.value);close();resizeTo(0,0);</script>""")
sPath = oExec.StdOut.ReadLine
Debug.Print sPath
End Sub
I saw other solutions that make use of other Office applications to show the dialog. These allow filtering and setting default directories but would be slow to initiate. See open a fileDialog in visio vba - Stack Overflow as an example. Yet other approaches use CommonDialogs but I think this is more likely to fail on 64bit machines. Add Open File Dialog to VBA
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
| Tags |
| visio vba macros |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Visio crashed & now file is blank | Moorhs | Visio | 1 | 12-27-2021 08:49 AM |
| Find the appropriate visio diagram | nightearth | Visio | 1 | 08-02-2021 04:10 PM |
| Link image from file into Visio | Vind | Visio | 0 | 11-08-2018 12:11 AM |
| Rename visio file & hyperlink | O'Neill | Visio | 0 | 05-08-2016 11:43 PM |
How do you find what command a toolbar button represents?
|
New Daddy | Word | 6 | 05-05-2012 12:35 PM |