Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I love the structure of the site. You start at the top, and drill down to what you want. Maybe I've been using Unix too long... :-) "

Geography

Where in the world do Tek-Tips members come from?

check if row two is blank in an excel file

daillest319 (Programmer)
18 Jul 12 14:29
i not sure how to do this but im trying to have my vbs script check if row 2 is empty in my Arrow.xls file. if its empty i want it to email from a template with the file and if there nothing in row 2 i want it to email from a different template.

so i need to check row two and email using two different otf files depending if the xls file has data in row 2
SkipVought (Programmer)
18 Jul 12 14:48
hi,

Quote:

if its empty i want it to email from a template with the file and if there nothing in row 2 i want it to email from a different template.
So what's the difference?

CODE

With YourExelObject
  if 
   .Counta(.YourWorkbookObject.YourSheetObject.Rows(2)) > 0 then
    ' have data in row 2
  else
    ' have no data in row 2
  end if
End with 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

daillest319 (Programmer)
18 Jul 12 15:34
i have two diffrent email to send if i recieve data and if i dont. im actually fine with the email part. just need check row two for data. im confused ion what im doing wrote this is what i have. i would like it to check this workbook and if there data i would like it to start formatting otherwise send an email.


CODE --> vbs

Set xlApp = Createobject("Excel.Application")
xlApp.Visible = False
xlApp.Screenupdating = False
xlApp.Workbooks.Open "C:\sample\test.xls.xls"
WScript.Sleep 1000

With xlApp.Workbooks("test.xls").ActiveSheet

.Range("A:AG").Font.Name = "Times New Roman"
.Range("A:AG").Font.Size = "10"
.Columns.AutoFit

End With

xlApp.ActiveWorkbook.Close True
xlApp.Quit
Set xlApp = Nothing 
SkipVought (Programmer)
18 Jul 12 15:45

CODE

Set xlapp = CreateObject("Excel.Application")
    xlapp.Visible = False
    xlapp.ScreenUpdating = False
    With xlapp.Workbooks.Open("C:\sample\test.xls.xls")
        WScript.Sleep 1000
        
        With .Sheets("Use An Actual Sheet Name")
            With .UsedRange
                .Font.Name = "Times New Roman"
                .Font.Size = "10"
                .Columns.AutoFit
            End With
            
            If xlapp.CountA(.Rows(2)) > 0 Then
              ' have data in row 2
            Else
              ' have no data in row 2
            End If
        End With
        
        .Close True
        
    End With
    
    xlapp.Quit
    Set xlapp = Nothing 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

daillest319 (Programmer)
18 Jul 12 16:38
thank you so much works perfect bigsmile

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close