LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA trouble when using Excel 2003 vs Excel 2002

I cannot use a template that has worked for excel 2000 and excel 2002 when i
switch to excel 2003. The template is used to format a worksheet with
proper headers and footers and tab names based on the input received through
a text box.

The first problem: The textbox is not working. Meaning - when i type
something in the textbox on a form and hit OK, the vba error checking comes
up and says that there is a "COMPILE ERROR: Can't find project or library".
This happens in the SecNum = TextBox1.Value part

The second problem: I have a BeforePrint routine that will place headers
and footers in the document. When I try to do a print preview, I get the
same message at the point where I try to specify Chr(10) as a carriage
return.

What can be happening here? I have included the VBA code...

Problem 1 code
'---------------------------------------------------------------------------
---
Private Sub CommandButton1_Click()
SecNum = TextBox1.Value
NumShts = 5

NumShts = Worksheets.Count
J = 65
For i = 1 To NumShts
origtext = Sheets(i).Range("A1").Value
If origtext = "" Then
GoTo endline
Else
NewText = "Exhibit " & SecNum & "-" & Chr(J)
Sheets(i).Range("a1").Value = NewText
Sheets(i).Name = SecNum & "-" & Chr(J)
J = J + 1
End If
endline: Next i

UserForm1.Hide
Sheets(1).Select
End Sub

Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub

Private Sub Label3_Click()

End Sub
'---------------------------------------------------------------------------
---


Problem 2 code
'---------------------------------------------------------------------------
--------
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = "&8" & ActiveWorkbook.FullName & Chr(10) & "&D &T"
.RightFooter = "&""ZapfHumnst Ult BT,Ultra Bold""Company Name"
.RightHeader = "&A &P"
End With
End Sub

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
If SaveAsUI = True Then Sheets("<---LastPage").Range("F18").Value = 1
End Sub

Private Sub Workbook_Open()
If Sheets("<---LastPage").Range("F18").Value = 0 Then UserForm1.Show
End Sub
'---------------------------------------------------------------------------
------------





 
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
Trouble with XY Scatter graphs Excel 2003/Office 2003 optomist1 Excel Discussion (Misc queries) 0 September 1st 09 10:07 PM
Trouble when trying to open a file excel 2007 in excel 2003 Martin Excel Discussion (Misc queries) 3 January 30th 09 02:05 PM
Trouble downloading KB918419 for Excel 2003 Huntress Excel Discussion (Misc queries) 2 August 29th 06 01:40 AM
trouble with Excel 2003 and dde flarsen Excel Discussion (Misc queries) 0 February 15th 06 07:53 PM
Trouble w/ ActiveX Controls (no userform) Excel 2002. Chris Excel Programming 2 November 14th 03 06:36 PM


All times are GMT +1. The time now is 04:26 PM.

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

About Us

"It's about Microsoft Excel"