Jump to content

Excel 2003 / data


Read
 Share

Recommended Posts

Sheet: January 2011 and A1 February.

How can it: February ???

Code: _ExcelWriteCell($oExcel, "January", "A1")

February 2011 is empty - That's bad.

I want:

January 2011 and A1 January.

February 2011 and A1 February

How to use Bold/color? <B>January</B>

#include <Excel.au3>
Local $January = "January 2011"
$oExcel = _ExcelBookNew()
With $oExcel
        .ActiveWorkbook.Sheets(1).Name = $January
    EndWith
    $oExcel.Range("A1").Select
    
_ExcelWriteCell($oExcel, "January", "A1")

Local $February = "February 2011"
With $oExcel
        .ActiveWorkbook.Sheets(2).Name = $February
    EndWith
    $oExcel.Range("A1").Select
    
_ExcelWriteCell($oExcel, "February", "A1")

Thanks

Link to comment
Share on other sites

You didn't change the active sheet to Sheets(2) just by renaming it, did you? So _ExcelWriteCell() is going to Sheets(1) both times. Try _ExcelSheetActivate().

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Hmm, I assume that i am doing something wrong.

Error (Line9): Incorrect number of parameters in function call

I searching forum "_ExcelSheetActivate()" only 2 post :)

#include <Excel.au3>
Local $January = "January 2011"
$oExcel = _ExcelBookNew()
With $oExcel
        .ActiveWorkbook.Sheets(1).Name = $January
    EndWith
    $oExcel.Range("A1").Select
    
_ExcelSheetActivate($oExcel, "January", "A1")

Local $February = "February 2011"
With $oExcel
        .ActiveWorkbook.Sheets(2).Name = $February
    EndWith
    $oExcel.Range("A1").Select
    
_ExcelWriteCell($oExcel, "February", "A1")

You didn't change the active sheet to Sheets(2) just by renaming it, did you? So _ExcelWriteCell() is going to Sheets(1) both times. Try _ExcelSheetActivate().

;)

Link to comment
Share on other sites

Work but more easily. Im noob, sorry.

Where you take January and February? If I want write A1 "Welcome" how them?

I'm bored. Less mess.

#include <Excel.au3>
$mJan = 'January 2011'
$mFeb = 'February 2011'
$oExcel = _ExcelBookNew()
_ExcelSheetNameSet($oExcel, $mJan)
_ExcelWriteCell($oExcel, StringTrimRight($mJan, 5), 1, 1)
_ExcelSheetActivate($oExcel, 2)
_ExcelSheetNameSet($oExcel, $mFeb)
_ExcelWriteCell($oExcel, StringTrimRight($mFeb, 5), 1, 1)

Edited by Read
Link to comment
Share on other sites

Work but more easily. Im noob, sorry.

Where I use A1 "text" B6 "text"

Where you take January and February? If I want write A1 "Welcome" how them?

You can write to a cell two basic ways using _ExcelWriteCell, they are:

_ExcelWriteCell($oExcel, 'Some Text', 1, 1);1, 1 = row1, col1

$var = 'Some Text'
_ExcelWriteCell($oExcel, $var, 1, 1);1, 1 = row1, col1

To make A2 read 'Welcome', I would add this line to my previous posts script.

I chose A2 to keep February in Cell A1.

_ExcelWriteCell($oExcel, 'Welcome', 2, 1)
Link to comment
Share on other sites

B4 "Text" > Right (xlRight)

How make it?

$oExcel.Cells(4, 2).Value = "Text" ;B4
$oExcel.Range("B4").Select
$oExcel.Selection.Font.Bold = True
With $oExcel.Selection.Font
.Name = "Arial"
.Size = 10

I tried to change it

$oExcel.Activesheet.Columns("B:B").HorizontalAlignment = 4;

vs

$oExcel.Activesheet.Columns("B4").HorizontalAlignment = 4;

Yes, it's not work ;)

Link to comment
Share on other sites

I did code but number is wrong / -4115

And this site not help me or help: http://msdn.microsoft.com/en-us/library/aa221100%28v=office.11%29.aspx

$oExcel.Range("B7:F31").Select
$oExcel.Selection.Borders.LineStyle = -4115

Open up Visual Basic Editor (from Excel press ALT+F11) then press F2 when you get into Visual Basic to get you into Object Browser. From there do a search for "xlLineStyle".

Link to comment
Share on other sites

I did code but number is wrong / -4115

And this site not help me or help: http://msdn.microsoft.com/en-us/library/aa221100%28v=office.11%29.aspx

$oExcel.Range("B7:F31").Select
$oExcel.Selection.Borders.LineStyle = -4115

xlContinuous = 1

Edit:

Like so: $oExcel.Selection.Borders.LineStyle = 1

$oExcel.Selection.Borders.Weight = 1

Edited by JoHanatCent
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...