nicky40 Posted April 16, 2009 Share Posted April 16, 2009 Hey guys, I'm trying to have my excel fuctions save to a folder specified by predetermined variables. I've had no luck, w/out the variables I can declare a location no problem, but then it all goes to hell with the variables. I need a lot of help on some excel scripts, I've never used any excel.au3 methods, and I'm trying to pop my n00b cherry. If anyone is willing to help I'd gladly reimburse you for your time, PM me for my AIM or MSN if you're willing to help! CODE#include<Excel.au3> $Pub_Code = "001" $Pub_Abr = "bto" $oExcel = _ExcelBookNew() _ExcelWriteCell($oExcel, "Test1", 1, 1) _ExcelBookSaveAs($oExcel, "H:\Remote\""Remot" & $Pub_Code" & "\SaveAsExample", "xls") MsgBox(0, "", "SaveAs") _ExcelWriteCell($oExcel, "Test2", 2, 2) _ExcelBookSave($oExcel) MsgBox(0, "", "Save") Link to comment Share on other sites More sharing options...
nicky40 Posted April 16, 2009 Author Share Posted April 16, 2009 Aim = Klufas15 MSN = Klufas15@hotmail.com Link to comment Share on other sites More sharing options...
WideBoyDixon Posted April 16, 2009 Share Posted April 16, 2009 _ExcelBookSaveAs($oExcel, "H:\Remote\Remot" & $Pub_Code & "\SaveAsExample", "xls") [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
nicky40 Posted April 16, 2009 Author Share Posted April 16, 2009 _ExcelBookSaveAs($oExcel, "H:\Remote\Remot" & $Pub_Code & "\SaveAsExample", "xls") Then when I try to declare both variables it fails again. Hrm _ExcelBookSaveAs($oExcel, "H:\Remote\Remot" & $Pub_Code & $Pub_Abr & "\SaveAsExample", "xls") That should work right? Link to comment Share on other sites More sharing options...
nicky40 Posted April 16, 2009 Author Share Posted April 16, 2009 I've tried more combinations that I thought would work but no dice, anybody have any ideas? Link to comment Share on other sites More sharing options...
nicky40 Posted April 16, 2009 Author Share Posted April 16, 2009 $10.00 to whoever can help me via paypal! Link to comment Share on other sites More sharing options...
system24 Posted April 16, 2009 Share Posted April 16, 2009 #include<Excel.au3> $Pub_Code = "001" $Pub_Abr = "bto" $Pub = $Pub_Code & $Pub_Abr $oExcel = _ExcelBookNew() _ExcelWriteCell($oExcel, "Test1", 1, 1) _ExcelBookSaveAs($oExcel, "H:\Remote\Remot" & $Pub & "\SaveAsExample", "xls") MsgBox(0, "", "SaveAs") _ExcelWriteCell($oExcel, "Test2", 2, 2) _ExcelBookSave($oExcel) MsgBox(0, "", "Save") _ExcelBookClose($oExcel) [center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center] Link to comment Share on other sites More sharing options...
Juvigy Posted April 16, 2009 Share Posted April 16, 2009 $oExcel = ObjCreate("Excel.Application") $oExcel.Workbooks.Add $oExcel.Sheets("sheet1").Select $oExcel.Range("A1").Value="adasdasdasdasd" $oExcel.ActiveWorkbook.SaveAs ("c:\test1.xls") $oExcel.ActiveWorkbook.Close You can send the 10 big ones to: joydivision106@gmail.com Link to comment Share on other sites More sharing options...
nicky40 Posted April 16, 2009 Author Share Posted April 16, 2009 $oExcel = ObjCreate("Excel.Application") $oExcel.Workbooks.Add $oExcel.Sheets("sheet1").Select $oExcel.Range("A1").Value="adasdasdasdasd" $oExcel.ActiveWorkbook.SaveAs ("c:\test1.xls") $oExcel.ActiveWorkbook.CloseYou can send the 10 big ones to:joydivision106@gmail.comI would, but I'm having trouble saving with multiple variables. Link to comment Share on other sites More sharing options...
nicky40 Posted April 16, 2009 Author Share Posted April 16, 2009 #include<Excel.au3> $Pub_Code = "001" $Pub_Abr = "bto" $Pub = $Pub_Code & $Pub_Abr $oExcel = _ExcelBookNew() _ExcelWriteCell($oExcel, "Test1", 1, 1) _ExcelBookSaveAs($oExcel, "H:\Remote\Remot" & $Pub & "\SaveAsExample", "xls") MsgBox(0, "", "SaveAs") _ExcelWriteCell($oExcel, "Test2", 2, 2) _ExcelBookSave($oExcel) MsgBox(0, "", "Save") _ExcelBookClose($oExcel) It's erroring out from the Excel.au3, heres the image incase you need to reference it: http://img26.imageshack.us/img26/9817/borked.png I tried commenting those lines out, and then it completes, but doesn't save when I check my directory. Thanks, Nick Link to comment Share on other sites More sharing options...
Juvigy Posted April 16, 2009 Share Posted April 16, 2009 I would, but I'm having trouble saving with multiple variables.What do you mean ?Tell me what exactly you want to do...Generally it should be repeating the line and just changing the "A1" and the value...:$oExcel.Range("A1").Value="adasdasdasdasd" Link to comment Share on other sites More sharing options...
nicky40 Posted April 16, 2009 Author Share Posted April 16, 2009 What do you mean ?Tell me what exactly you want to do...Generally it should be repeating the line and just changing the "A1" and the value...:$oExcel.Range("A1").Value="adasdasdasdasd"CODE$Pub_Code = "001"$Pub_Abr = "\bto"$Remote = "Remote"$Nick = " Nick"$Pub = $Pub_Code & $Pub_Abr$oExcel = ObjCreate("Excel.Application")$oExcel.Workbooks.Add$oExcel.Sheets("sheet1").Select$oExcel.Range("A1").Value="adasdasdasdasd"$oExcel.ActiveWorkbook.SaveAs ("H:\Remote\Remot" & $Pub & "SaveAsExample")$oExcel.ActiveWorkbook.CloseI'm trying to get it to save in "H:\Remote\Remot001\labels\bto"If you can figure that out, and it saves properly, you get 10 bucks, the only thing it's doing ATM is saving to my remote001 folder as botSaveAsExample Link to comment Share on other sites More sharing options...
calc0000 Posted April 16, 2009 Share Posted April 16, 2009 Well, you need to put "labels\" or some variant thereof into $Pub, or you cannot expect it to save into the directory. Also, $Pub needs to end with a backslash "\". Link to comment Share on other sites More sharing options...
nicky40 Posted April 16, 2009 Author Share Posted April 16, 2009 Well, you need to put "labels\" or some variant thereof into $Pub, or you cannot expect it to save into the directory. Also, $Pub needs to end with a backslash "\".I'm mentall handicap, and failed to account for the folder between directories. Thank you sir. Link to comment Share on other sites More sharing options...
Juvigy Posted April 17, 2009 Share Posted April 17, 2009 So is it working now? Who got the 10 bugs as i havent Link to comment Share on other sites More sharing options...
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