N
Nicolas Kicillof
I need the user of my Visio solution to be able to select a text file to import some data from (this is triggered by clicking on a button in a form). In other office applications, I would do this
Dim fd as FileDialo
set fd = Application.FileDialog(msoFileDialogFilePicker
...
The first line works in Visio, as my project has a reference to the Office Object Library. But the second line won't, because the Visio Application objects lacks the FileDialog property
So, I added a reference to the Microsoft Common Dialog Control, inserted one of those in my form, and was able to do the trick with this code
With CommonDialog
.Filter = "Comma Separated Values (*.txt;*.csv)|*.txt;*.csv
.Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly Or cdlOFNLongName
.ShowOpe
If .FileName <> "" The
DocEvents.FromFile .FileNam
End I
EvSetToShape DocEvents, MyShape.Document.DocumentSheet 'reflect changes in the document shee
UpdateList l 'reflect changes in the listbo
End Wit
The problem is that, before this, my solution was very easy to distribute (just by copying the template and stencil). Now I have to distribute the .ocx and .dll too, and make sure they are registered. I built all my solution in VBA, so that I didn't need an installer. Now I need one.
How can I avoid this? Is there an easy, built-in way to show a common dialog in Visio
Thanks in advance
Nicolas Kicillof
Dim fd as FileDialo
set fd = Application.FileDialog(msoFileDialogFilePicker
...
The first line works in Visio, as my project has a reference to the Office Object Library. But the second line won't, because the Visio Application objects lacks the FileDialog property
So, I added a reference to the Microsoft Common Dialog Control, inserted one of those in my form, and was able to do the trick with this code
With CommonDialog
.Filter = "Comma Separated Values (*.txt;*.csv)|*.txt;*.csv
.Flags = cdlOFNFileMustExist Or cdlOFNHideReadOnly Or cdlOFNLongName
.ShowOpe
If .FileName <> "" The
DocEvents.FromFile .FileNam
End I
EvSetToShape DocEvents, MyShape.Document.DocumentSheet 'reflect changes in the document shee
UpdateList l 'reflect changes in the listbo
End Wit
The problem is that, before this, my solution was very easy to distribute (just by copying the template and stencil). Now I have to distribute the .ocx and .dll too, and make sure they are registered. I built all my solution in VBA, so that I didn't need an installer. Now I need one.
How can I avoid this? Is there an easy, built-in way to show a common dialog in Visio
Thanks in advance
Nicolas Kicillof