Passing an argument string from vb to a vba macro

Passing an argument string from vb to a vba macro

Anonymous
Not applicable
495 Views
4 Replies
Message 1 of 5

Passing an argument string from vb to a vba macro

Anonymous
Not applicable
Hi,
I'm having trouble Passing an argument string from vb to a vba macro in a
batch plot routine I'm writing.
As vba does not have an drive list, dir list tools etc I decided to use vb6
to do the processing and call my vba plot macro which works on (VBA_LOADER
"K:/A2k/Vb-Macros/MyPlot.Dvb")(vl-vbarun "MyPlot") "A1 TO A3" from a menu
and tool button call.

But I cant pass the string with either

autocad.Application.ActiveDocument.SendCommand ("-vbarun" "MyPlot" "A1 TO
A3")

or

autocad.Application.RunMacro "Module1.MyPlot" "A1 TO A3"

in VB any clues ??

Also many thanks to the input I have received so far
0 Likes
496 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
hi, i'm sure there are many people much more qualified to answer this, but i think you need to make the argument variable globally visible, or if worst comes to worst just thisdrawing.SetVariable("USERS1") and have the plot procedure get it.
0 Likes
Message 3 of 5

Anonymous
Not applicable
"Trevor Wickham" wrote in message
news:98C0E10F1EE0543E1E0FA95D0A52E636@in.WebX.maYIadrTaRb...
> Hi,
> I'm having trouble Passing an argument string from vb to a vba macro in a
> batch plot routine I'm writing.
> As vba does not have an drive list, dir list tools etc I decided to use
vb6
> to do the processing and call my vba plot macro which works on (VBA_LOADER
> "K:/A2k/Vb-Macros/MyPlot.Dvb")(vl-vbarun "MyPlot") "A1 TO A3" from a menu
> and tool button call.
>
> But I cant pass the string with either
>
> autocad.Application.ActiveDocument.SendCommand ("-vbarun" "MyPlot" "A1 TO
> A3")
>
> or
>
> autocad.Application.RunMacro "Module1.MyPlot" "A1 TO A3"
>
> in VB any clues ??
>
> Also many thanks to the input I have received so far


I don't know much about VBA, but if you can do this (i.e. use APIs and the
Split function) it could solve your problem:

Declare Function GetLogicalDriveStrings Lib "Kernel32" Alias
"GetLogicalDriveStringsA" (ByVal nBufferLength As Long, ByVal lpBuffer As
String) As Long


Dim DirPath As String
Dim ret As Long
Dim vDrivesPaths

DirPath = Space$(GetLogicalDriveStrings(0, DirPath))
ret = GetLogicalDriveStrings(Len(DirPath), DirPath)
vDrivesPaths = Split(DirPath, vbNullChar)

vDrivesPaths is now a variant array with each drive on the system.
I assume you could use Dir$ for directories?

--Art
0 Likes
Message 4 of 5

Anonymous
Not applicable
Try the GetSetting() & SetSetting() functions to read/write to the registy's
application data area. Try the MS Common Dialog Control to list/select
drives, folders, & files.
--
John Goodfellow
irtfnm
use john at goodfellowassoc dot com

"Trevor Wickham" wrote in message
news:98C0E10F1EE0543E1E0FA95D0A52E636@in.WebX.maYIadrTaRb...
> Hi,
> I'm having trouble Passing an argument string from vb to a vba macro in a
> batch plot routine I'm writing.
> As vba does not have an drive list, dir list tools etc I decided to use
vb6
> to do the processing and call my vba plot macro which works on (VBA_LOADER
> "K:/A2k/Vb-Macros/MyPlot.Dvb")(vl-vbarun "MyPlot") "A1 TO A3" from a menu
> and tool button call.
>
> But I cant pass the string with either
>
> autocad.Application.ActiveDocument.SendCommand ("-vbarun" "MyPlot" "A1 TO
> A3")
>
> or
>
> autocad.Application.RunMacro "Module1.MyPlot" "A1 TO A3"
>
> in VB any clues ??
>
> Also many thanks to the input I have received so far
>
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
The suggestion worked a treat. Many thanks for the
info

 



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">hi,
i'm sure there are many people much more qualified to answer this, but i think
you need to make the argument variable globally visible, or if worst comes to
worst just thisdrawing.SetVariable("USERS1") and have the plot procedure get
it.
0 Likes