Sign in to follow this  
Followers 0
nicky40

Please help with my excel problem :(

15 posts in this topic

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")

Share this post


Link to post
Share on other sites



Aim = Klufas15

MSN = Klufas15@hotmail.com

Share this post


Link to post
Share on other sites

_ExcelBookSaveAs($oExcel, "H:\Remote\Remot" & $Pub_Code & "\SaveAsExample", "xls")

Share this post


Link to post
Share on other sites

_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?

Share this post


Link to post
Share on other sites

I've tried more combinations that I thought would work but no dice, anybody have any ideas?

Share this post


Link to post
Share on other sites

$10.00 to whoever can help me via paypal!

Share this post


Link to post
Share on other sites

#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]

Share this post


Link to post
Share on other sites

$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

Share this post


Link to post
Share on other sites

$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

I would, but I'm having trouble saving with multiple variables.

Share this post


Link to post
Share on other sites

#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

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

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.Close

I'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

Share this post


Link to post
Share on other sites

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 "\".

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

So is it working now? Who got the 10 bugs as i havent ^_^

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  
Followers 0