David,
I'm new to VBA programming and just learned how to call the xyyy sub procedure. We just finished testing and have 1000+ csv files that have to be plotted. It would be helpful if the process could be further automated by calling the .set function within Dplot. This may not be possible since the .set file does not reside within the dplot library, but any recommendations would be appreciated.
Thanks,
Phil Mathis
Can you call a .set from VBA?
Moderator: DPlotAdmin
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
Code: Select all
Dim doc As Long
Dim ret As Long
.
.
Call XYXY
doc = DPlotGetActiveDocument()
If doc > 0 Then
ret = DPlot_Command(doc, "[GetPreferences(""filename.set"")]")
End If
Visualize Your Data
support@dplot.com
support@dplot.com
-
- Posts: 21
- Joined: Thu Dec 10, 2009 10:55 pm
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
My best guess is you're using an older version of the Add-In, in which DPlotGetActiveDocument is marked "Private" - that is, it is inaccessible from other modules. To change it to "Public" open VBA and click on the + sign next to "dplotlib (dplotlib.xla)" in the left pane. (If you are prompted for a password, use "dplot" w/o the quotes. Then click next to Modules, and double-click on DPlotData. Search for DPlotGetActiveDocument and change
Private Function DPlotGetActiveDocument() As Long
to
Public Function DPlotGetActiveDocument() As Long
Private Function DPlotGetActiveDocument() As Long
to
Public Function DPlotGetActiveDocument() As Long
Visualize Your Data
support@dplot.com
support@dplot.com
-
- Posts: 21
- Joined: Thu Dec 10, 2009 10:55 pm
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
Yes, and the same applies to any character string arguments to DPlot_Command commands. The entire command is a character string and has another character string embedded. VBA would see
DPlot_Command(doc, "[GetPreferences("filename.set")]")
as
DPlot_Command(doc, "[GetPreferences("
followed by nonsense and report a syntax error. The doubled quotes are the same as (but much easier than):
DPlot_Command(doc, "[GetPreferences(" & char(34) & "filename.set" & char(34) & ")]")
DPlot_Command(doc, "[GetPreferences("filename.set")]")
as
DPlot_Command(doc, "[GetPreferences("
followed by nonsense and report a syntax error. The doubled quotes are the same as (but much easier than):
DPlot_Command(doc, "[GetPreferences(" & char(34) & "filename.set" & char(34) & ")]")
Visualize Your Data
support@dplot.com
support@dplot.com