Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-13-2016, 08:21 PM
zcu zcu is offline object variable set or not??? Challenging \ Perplexing Windows 8 object variable set or not??? Challenging \ Perplexing Office 2010 64bit
Novice
object variable set or not??? Challenging \ Perplexing
 
Join Date: Jan 2016
Posts: 2
zcu is on a distinguished road
Default object variable set or not??? Challenging \ Perplexing

Hi

I'm a newbie please be nice



I'm trying to write an if then else and I'm referring to the same variable. Yet when the if is true the variable is an error "not set".

But if it is false the code works perfectly.

Code:
For i = 1 To 10
'get student name from worksheet
x = ox.Worksheets("data").Cells(21, 2 + i).Text

With ActivePresentation.Slides(2).Shapes("name" & i)
.TextFrame.TextRange.Text = x
End With
'check if student pic in file

On Error Resume Next
xipath = Dir("C:\ProgramData\Learning Excellence\Behavior\Pictures\" & x & ".jpg")
On Error GoTo 0

' if not = forecolor white
If xipath = "" Then
With ActivePresentation.Slides(2).Shapes("pic" & i)
.Fill.ForeColor.RGB = RGB(255, 255, 255)
End With

' if yes = forecolor picture
Else
With ActivePresentation.Slides(2).Shapes("pic" & i)
.Fill.UserPicture ("C:\ProgramData\Learning Excellence\Behavior\Pictures\" & x & ".jpg")
End With
End If
   Next i
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Variable or With block variable not set Raza Excel Programming 8 01-15-2015 12:19 AM
Run Time Error '91': Object variable or With block variable not set using Catalogue Mailmerge Berryblue Mail Merge 1 11-13-2014 05:36 PM
object variable set or not??? Challenging \ Perplexing Run-time error 91 object variable or with block variable not set JUST ME Word VBA 4 03-25-2014 06:56 AM
object variable set or not??? Challenging \ Perplexing object variable or with block variable not set MJP143 Excel 1 02-11-2013 05:07 AM
object variable set or not??? Challenging \ Perplexing Run-time error '91': Object variable or With block variable not set tinfanide Excel Programming 2 06-10-2012 10:17 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:47 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft