![]() |
|
#1
|
|||
|
|||
|
Hi,
I wrote VBA code that saves some objects' properties to a CSV file. Here is part of the code: Code:
Filename = CorelScriptTools.GetFileBox(dialogBoxType, dialogBoxTitle, 1)
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile Filename
Set f = fs.GetFile(Filename)
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
I think this requires an If Then Else, but I don't know exactly what to write. Thank you so much in advance! |
|
#2
|
||||
|
||||
|
Yes, if the file box was canceled then the function will return an empty string. You just need to check for this:
Code:
Filename = CorelScriptTools.GetFileBox(dialogBoxType, dialogBoxTitle, 1)
If Filename <> "" Then
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CreateTextFile Filename
Set f = fs.GetFile(Filename)
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
...
End If
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Adding a button to toolbars to run a VBA macro | Alex | FAQ | 4 | 10-05-2007 08:07 |
| Cannot use Curveworks macros in a user witten macro??? | jon46089 | CurveWorks | 2 | 02-03-2006 14:18 |
| New macro to clip curves w.r.t. a border | Gerard Hermans | Macros/Add-ons | 0 | 09-06-2003 07:50 |