Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Error occur while loading Sheet1811111111111111111" Help Please!

Hi, How can I get this piece of code to run each time I open up an
excel document. I'm using lotusscript to print out excel documents and
its giving me this error, I just want to automatically click yes each
time or somehow ignore it.

Do I put this code somewhere in my personal.xls and have it popup from
there?

Thanks,
Charles

'==============================================
Sub ChangeHardcodedSheetName()
'change the VBE 'Actual' name of a sheet to the same as the 'tab'
name
'written by Tom Ogilvy 05/25/2000 in response to a
' question on the Microsoft.public.excel.programming newsgroup
'(You might need to create a reference to
' Microsoft Visual Basic for Applications Extensibility Library
' in Tools References in the VBE) - taken care of in
AddVbideReferenceFromGUID
' line of code
'
' Reference to AddVbideReferenceFromGUID - UDF
' Reference to function CheckForLegalAnsi - UDF

Dim iWkshtCount As Integer, i As Integer
Dim strName As String
Dim wkshtSheet As Worksheet

AddVbideReferenceFromGUID 'Add Reference to Extensibility if not
already available

iWkshtCount = Application.ActiveWorkbook.Worksheets.Count

For i = 1 To iWkshtCount
Set wkshtSheet = Application.Worksheets(i)
strName =
Application.WorksheetFunction.Substitute(wkshtShee t.Name,
" ", "")
strName = Application.WorksheetFunction.Substitute(strName,
"(",
"_")
strName = Application.WorksheetFunction.Substitute(strName,
")",
"_")

wkshtSheet.Parent.VBProject.VBComponents(wkshtShee t.CodeName)
_
.Properties("_CodeName") = CheckForLegalAnsi(strName)
Next i

End Sub
'==============================================
Function CheckForLegalAnsi(strCheckName As String) As String
Dim i As Integer, iTest As Integer, iChecker As Integer
Dim strBuildLegalName As String

If Len(strCheckName) = 0 Then
CheckForLegalAnsi = "Unknown"
Exit Function
End If

strBuildLegalName = ""

'Test for illegal DOS characters in name
For i = 1 To Len(strCheckName)
iTest = 0
iChecker = Asc(Mid(strCheckName, i, 1))
If iChecker = 48 Then
If iChecker <= 57 Then
iTest = 1
Else
If iChecker = 65 Then
If iChecker <= 90 Then
iTest = 1
Else
If iChecker = 95 Then
iTest = 1
Else
If iChecker = 97 Then
If iChecker <= 122 Then
iTest = 1
End If
End If
End If
End If
End If
End If
End If
If iTest = 0 Then
If i = 1 Then
strBuildLegalName = strBuildLegalName & "a_"
Else
strBuildLegalName = strBuildLegalName & "_"
End If
Else
strBuildLegalName = strBuildLegalName & Mid(strCheckName,
i, 1)
End If
Next i

CheckForLegalAnsi = strBuildLegalName

End Function
'================================================= =
Sub AddVbideReferenceFromGUID()
'Add Microsoft Visual Basic for Applications Extensibility reference
' VBIDE
' normally at C:\PROGRAM FILES\COMMON FILES\MICROSOFT
SHARED\VBA\VBEEXT1.OLB
'
On Error GoTo Err_AddVbideReference
Dim VarAddReference
Dim refReference
Dim iErrorCounter As Integer
'MsgBox "GUID is: " &
ThisWorkbook.VBProject.References("VBIDE").GUID

iErrorCounter = 0

VarAddReference = _

ActiveWorkbook.VBProject.References.AddFromGuid("{ 0002E157-0000-0000-
C000-00
0000000046}", 5, 0)

Exit_AddVbideReference:
Exit Sub

Err_AddVbideReference:
iErrorCounter = iErrorCounter + 1
If Err = 32813 Then ' if Reference already active, ignore error
and
exit
Resume Exit_AddVbideReference
End If
If iErrorCounter 4 Then
Resume Exit_AddVbideReference
End If
If Err = 438 Then ' Object doesn't support this property or method
' This error is often gotten first time thru a
add
reference routine
AddVbideReferenceFromGUID
Exit Sub
End If
MsgBox "Error: " & Err & " - " & Err.Description
Resume Exit_AddVbideReference

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
"Document not saved" "error in loading DLL" Tracey L Excel Discussion (Misc queries) 0 December 1st 08 12:57 PM
Error occur while loading Sheet1811111111111111111" HELP!! Charles Excel Discussion (Misc queries) 0 July 8th 08 08:10 PM
Excel 2007 "Error loading DLL" alexcn Excel Programming 0 May 1st 07 05:53 PM
"error loading DLL" message SteveH Excel Discussion (Misc queries) 0 January 16th 06 08:53 AM
Excel automation "Error loading DLL" Paul Hewson Excel Programming 0 January 5th 04 08:34 PM


All times are GMT +1. The time now is 01:49 AM.

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"