mikeqf Posted April 12, 2005 Posted April 12, 2005 Hi all. I'm updating a script from vbscript to AutoIt, and I'm having some trouble with the formatting of some COM commands. In the script, I am using the COM interface for Excel, Access, and SMS. I've "translated" most of the code with no issue. The problem occurs when I try to run a couple of commands in particular. VBScript: (works perfectly) Collection.AddMembershipRule CollectionRule AutoIt: (does not work) $Collection.AddMembershipRule $CollectionRule VBScript: (works perfectly) objaccess.docmd.transferspreadsheet 1,8,"Query","spreadsheet.xls",True AutoIt: (does not work) $ObjAccess.DoCmd.TransferSpreadsheet 1,8,"Query","spreadsheet.xls",True I get the same error when AutoIt attempts to run these lines: "Error: The requested action with this object has failed." Every other COM command I run works fine. The difference is that none of the others have spaces in them. I'm guessing that is the issue. Anyone have any idea how I can format this so AutoIt can process it? I've tried different variations of quotation marks, parentheses, but I just can't get it. Thanks!
bshoenhair Posted April 12, 2005 Posted April 12, 2005 Try $Collection.AddMembershipRule($CollectionRule) $ObjAccess.DoCmd.TransferSpreadsheet(1,8,"Query","spreadsheet.xls",True)
mikeqf Posted April 13, 2005 Author Posted April 13, 2005 (edited) $Collection.AddMembershipRule($CollectionRule) Worked great. I thought I had tried it like that, but I guess not! $ObjAccess.DoCmd.TransferSpreadsheet(1,8,"Query","spreadsheet.xls",True) Still doesn't work. I also tried the below, and it didn't work either: $transfer = '1,8,"Query","spreadsheet.xls",True' $ObjAccess.DoCmd.TransferSpreadsheet($transfer) Anyone have any other ideas? Thanks! Edited April 13, 2005 by mikeqf
SvenP Posted April 13, 2005 Posted April 13, 2005 $Collection.AddMembershipRule($CollectionRule)Worked great. I thought I had tried it like that, but I guess not!$ObjAccess.DoCmd.TransferSpreadsheet(1,8,"Query","spreadsheet.xls",True)Still doesn't work. I also tried the below, and it didn't work either:$transfer = '1,8,"Query","spreadsheet.xls",True' $ObjAccess.DoCmd.TransferSpreadsheet($transfer)Anyone have any other ideas? Thanks!<{POST_SNAPBACK}>Mike,AutoIt doesn't support the keywords false/true. You could replace 'true' with numeric 1 and 'false' with numeric 0. $ObjAccess.DoCmd.TransferSpreadsheet(1,8,"Query","spreadsheet.xls",1) However I'm not sure if TransferSpreadsheet() will accept this kind of substitution.Regards,-Sven
mikeqf Posted April 14, 2005 Author Posted April 14, 2005 Thanks Sven, That did it for me. $ObjAccess.DoCmd.TransferSpreadsheet(1,8,"Query","spreadsheet.xls",1) Worked great!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now