#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default wordart

why does the following code work unless called by a form??? I have a form
that calls the routine but always gives the error 1004 application or object
not defined error, BUT if you step thriough the code it works perfectly with
no error. Any help?
on error resume next only skips the code.

Public Sub sendtotest() 'strStr1 As String, strStr2 As String)
Dim strString1 As String
Dim strString2 As String
strString1 = "DCH1205" 'worksheet name
strString2 = "Why can't I get this to WORK!!!"
Call test(strString1, strString2)
End Sub


Public Sub test(strString1 As String, strString2 As String)
Dim strText As String
Dim strworksheet As String
strText = strString2
strworksheet = strString1
Set myDocument = Worksheets(strworksheet)
Set newWordArt = myDocument.Shapes.AddTextEffect( _
PresetTextEffect:=msoTextEffect28, Text:=strText, _
FontName:="Impact", FontSize:=36, _
FontBold:=msoFalse, FontItalic:=msoFalse, Left:=10, _
Top:=10)
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default wordart

Hi,
your code works fine for me whether i run SendToTest directly or from the
click of a button in a userform, whether the referenced sheet is the
activesheet or not.

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Shawn G." wrote:

why does the following code work unless called by a form??? I have a form
that calls the routine but always gives the error 1004 application or object
not defined error, BUT if you step thriough the code it works perfectly with
no error. Any help?
on error resume next only skips the code.

Public Sub sendtotest() 'strStr1 As String, strStr2 As String)
Dim strString1 As String
Dim strString2 As String
strString1 = "DCH1205" 'worksheet name
strString2 = "Why can't I get this to WORK!!!"
Call test(strString1, strString2)
End Sub


Public Sub test(strString1 As String, strString2 As String)
Dim strText As String
Dim strworksheet As String
strText = strString2
strworksheet = strString1
Set myDocument = Worksheets(strworksheet)
Set newWordArt = myDocument.Shapes.AddTextEffect( _
PresetTextEffect:=msoTextEffect28, Text:=strText, _
FontName:="Impact", FontSize:=36, _
FontBold:=msoFalse, FontItalic:=msoFalse, Left:=10, _
Top:=10)
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default wordart

Your right, it works. EXCEPT in my project!!!!!!! ARRRRGGGGGHHHH!
Any clue what might be causeing that error, OR a way to bypass the error so
the user doesn't see it???

"sebastienm" wrote:

Hi,
your code works fine for me whether i run SendToTest directly or from the
click of a button in a userform, whether the referenced sheet is the
activesheet or not.

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Shawn G." wrote:

why does the following code work unless called by a form??? I have a form
that calls the routine but always gives the error 1004 application or object
not defined error, BUT if you step thriough the code it works perfectly with
no error. Any help?
on error resume next only skips the code.

Public Sub sendtotest() 'strStr1 As String, strStr2 As String)
Dim strString1 As String
Dim strString2 As String
strString1 = "DCH1205" 'worksheet name
strString2 = "Why can't I get this to WORK!!!"
Call test(strString1, strString2)
End Sub


Public Sub test(strString1 As String, strString2 As String)
Dim strText As String
Dim strworksheet As String
strText = strString2
strworksheet = strString1
Set myDocument = Worksheets(strworksheet)
Set newWordArt = myDocument.Shapes.AddTextEffect( _
PresetTextEffect:=msoTextEffect28, Text:=strText, _
FontName:="Impact", FontSize:=36, _
FontBold:=msoFalse, FontItalic:=msoFalse, Left:=10, _
Top:=10)
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
WordArt Bojingles03 New Users to Excel 3 February 17th 09 06:09 PM
WordArt - stretching aehdbe Excel Discussion (Misc queries) 0 March 28th 08 06:36 PM
Wordart in Excel D angel Excel Worksheet Functions 1 August 10th 06 06:46 PM
Print a WordArt in a Frontpage smr78[_3_] Excel Programming 0 August 16th 05 12:25 PM
Hiding Shapes When Not WordArt , or When WordArt Text < "Draft" Carroll Rinehart Excel Programming 2 September 18th 04 07:40 PM


All times are GMT +1. The time now is 03:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"