Jump to content
Sign in to follow this  

_WordMacroRun with argument problem

Recommended Posts


Hi everybody,

Sub Bookmarks() is a VBA macro which puts... bookmarks in a Word document. Working fine from autoit with :

_WordMacroRun($oWordApp, "Bookmarks")

Sub Bookmarks(ByVal nbre As Integer) is quite the same macro : I just added a MsgBox for testing purpose. Still working fine from VBA, but no more from autoit with :

_WordMacroRun($oWordApp, "Bookmarks", 2)

I tried (rather blindly) ByVal --> ByRef and ("test", String) in place of (2, Integer) without succes.

I'm afraid I need some help ! Thanks in advance.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Similar Content

    • CT83
      By CT83
      Dir_Load("Target1", "GS1_TarToday", $GS1_TarToday) ;here Target1 is a dir. and GS1_TarToday is a filename. $GS1_TarToday is the edit box in which i want to display info set by dir_load function Func Dir_Load($cS_Group,$cS_Name,$cVData,$cSavedPath="Configurations\Default") Local $cCurrent_Path=String($cSavedPath&"\"&$cS_Group&"\"&$cS_Name&".ct83") Local $cFileData If Not _FileReadToArray($cCurrent_Path,$cFileData, 0) Then MsgBox($MB_SYSTEMMODAL, "", "There was an error Reading the "& $cS_Group&"\"&$cS_Name &".ct83 File ! Please Try again! ") EndIf Local $cFileData1 = _ArrayToString($cFileData) GUICtrlSetData($cVData,$cFileData1) Endfunc The above code is meant to set the data of the edit box to a file GS1_TarToday.ct83 in Target1 folder ( $cFileData1 ) but this code simply does nothing. No errors are returned. still the data of the edit box remains as it is, 
    • mdwerne
      By mdwerne
      I'm attempting to created a windows task using SCHTASKS, but seem to have my formatting incorrect as a double quote is getting stripped out. How might I correct my code to resolve this dilemma?
      #RequireAdmin #include <AutoItConstants.au3> Global $TaskName, $sStartTime, $Program, $ProgramName, $Argument $TaskName = "MyTask" $sStartTime = "15:00" $ProgramName = "\\Server\share\myapp.exe" $Argument = " /verbose" $Program = '"' & $ProgramName & '"' & $Argument & '"' MsgBox(0, "Program with Argument", $Program) Scheduler() Func Scheduler() Local $sCmd, $sStartDate, $sDateTime, $sXtra_Parms, $Result Local $QueryTask = Run("SCHTASKS /QUERY /TN " & $TaskName, "", @SW_HIDE, $STDOUT_CHILD) Local $line = "" If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Or @OSVersion = "WIN_8" Or @OSVersion = "WIN_81" Then $sXtra_Parms = " /Z /V1" While 1 $line &= StdoutRead($QueryTask) If @error Then ExitLoop WEnd If $line = "" Then MsgBox(1, "Task Command", 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & '"' & $Program & '"' & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms) $sCmd = 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & '"' & $Program & '"' & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms ;$sCmd = 'SCHTASKS /CREATE /TN ' & $TaskName & ' /TR ' & $Program & ' /ST ' & $sStartTime & ' /SC ONCE /RU SYSTEM' & $sXtra_Parms Else $sCmd = 'SCHTASKS /CHANGE /TN ' & $TaskName & ' /ST ' & $sStartTime EndIf $Result = Run($sCmd, "", @SW_HIDE) If $Result > 0 Then MsgBox(64, "Success!!", "The task was successfully created.") Else MsgBox(48, "Sorry...", "There was a problem scheduling this installation, please contact the HelpDesk for assistance.") EndIf EndFunc ;==>Scheduler The task is created with the above code, except the formatting is wrong so I getting an invalid directory error upon run time.
      The above creates this command (Serversharemyapp.exe" /verbose) in the task scheduler.
      What I'm actually trying to get is ("Serversharemyapp.exe" /verbose)
      The first double quote is being stripped out using my faulty code.
      Any suggestions?
      Thanks for your time,

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.