First post please help... excel problem...

Hello,

GREAT BOARD!!! lots of good info.. how active is the vb forum??

anyway.. im having a bit of an excel problem.

I am using textboxes to populate cells in a work sheet.. my only problem now is that for some reason the workbooks are not always opening on the first page like they were on my computer... so i need to make sure i paste info onto the correct worksheet

this is the code i was using:

With objExcel ' Use With...End With so you don't have to type objExcel over and over again

' Open your workbook
.Visible = True
.Workbooks.Open(FileName:="c:p4y.xls")

End With


With objExcel

.Cells(1, 3) = TextBox1.Text ' bank name

this would open excel and then paste the data for me.. but if excel opens the book on a different worksheet.. not the first one im screwed...

how can i modify the cells statement to always paste to a certain worksheet or how can i make sure that the workbook always opens to the first worksheet??

thanks for the help
Tom

Comments

  • : Hello,
    :
    : GREAT BOARD!!! lots of good info.. how active is the vb forum??
    :
    : anyway.. im having a bit of an excel problem.
    :
    : I am using textboxes to populate cells in a work sheet.. my only problem now is that for some reason the workbooks are not always opening on the first page like they were on my computer... so i need to make sure i paste info onto the correct worksheet
    :
    : this is the code i was using:
    :
    : With objExcel ' Use With...End With so you don't have to type objExcel over and over again
    :
    : ' Open your workbook
    : .Visible = True
    : .Workbooks.Open(FileName:="c:p4y.xls")
    :
    : End With
    :
    :
    : With objExcel
    :
    : .Cells(1, 3) = TextBox1.Text ' bank name
    :
    : this would open excel and then paste the data for me.. but if excel opens the book on a different worksheet.. not the first one im screwed...
    :
    : how can i modify the cells statement to always paste to a certain worksheet or how can i make sure that the workbook always opens to the first worksheet??
    :
    : thanks for the help
    : Tom
    :
    I added the following line before the .cells assignment:
    .Sheets(1).Activate
    and it seems to work. That was very quick and dirty testing, but may keep you going.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion