VbANewbie13
New Member
- Joined
- Dec 9, 2011
- Messages
- 8
Good morning Experts!
I am in much need of your assistance. Please bear with me as I am still learning
I have a Excel Form that was developed in 2007 and we have now migrated to 2010 and the form is throwing many errors that I am unable to pinpoint the issues. To name a few: Runtime Error 91, Not Creating/Saving in Desktop Folder, Runtime error 91, when new unedited file is opened the Calendar Class not allowing me to select today's date (showing as 00 Jan 1900 when selecting today's date). To further explain:
PROBLEM #1 ::::
Upon opening the form (and once 'Enable Editing' button is clicked), I receive a Run-time error '91': Object Variable or With block variable not set and the Debugger points out the following line:
Below is the whole block of code located on ThisWorkbook:
PROBLEM #2 :::
When the original form is opened (and 'Enable Editing' button is clicked), it should also check to see if the /Requests/ folder is on the desktop and if not create the folder. This functionality is broken also.
PROBLEM #3 :::
Once the form is submitted by the original requestor, the form content becomes locked, and the form is sent via email to the next level for approval. The next Runtime Error 91 occurs when the approver opens the file from the email and selects 'Enable Editing'. Runtime Error 91: Object Variable or With block variable not set
PROBLEM #4 :::
When originally created the form contained 2 calendars based on the calendar control/date picker avail in 2007. As you know 2010 does not include a calendar control/date picker (my users are with SP1 and no admin rights on machines to D/L or register the new control 11.0 avail with SP4). In researching I found a Calendar Class solution that works with one small issue, it will not allow me to select today's date. When todays date is selected it places 00 jan 1900 in the field designated for the date. I thought that I had migrated everything from the 2007 Calendar Control to using the new Calendar Class, but must have done something wrong....(this is the Calendar Control Class that I integrated: https://sites.google.com/site/e90e50/calendar-control-class[/URL] )
This is the code on my UserForm1:
Any assistance would be greatly appreciated and I hope that I have provided enough information and posted correctly, if not, please let me know and I will do what I can to help/correct.
THANK YOU!!!
VbANewbie13
I am in much need of your assistance. Please bear with me as I am still learning
I have a Excel Form that was developed in 2007 and we have now migrated to 2010 and the form is throwing many errors that I am unable to pinpoint the issues. To name a few: Runtime Error 91, Not Creating/Saving in Desktop Folder, Runtime error 91, when new unedited file is opened the Calendar Class not allowing me to select today's date (showing as 00 Jan 1900 when selecting today's date). To further explain:
PROBLEM #1 ::::
Upon opening the form (and once 'Enable Editing' button is clicked), I receive a Run-time error '91': Object Variable or With block variable not set and the Debugger points out the following line:
Code:
ActiveWindow.DisplayWorkbookTabs = False
Below is the whole block of code located on ThisWorkbook:
Code:
Private Sub Workbook_Open()
ActiveWindow.DisplayWorkbookTabs = False
If Sheets("Sheet2").Visible = True Or Sheets("Emails").Visible = True Or Sheets("Help").Visible = False Then
ThisWorkbook.Unprotect Password:="password"
Sheets("Sheet2").Visible = False
Sheets("Emails").Visible = False
Sheets("Help").Visible = True
ThisWorkbook.Protect Structure:=True, Windows:=False, Password:="password"
End If
'ThisWorkbook.Protect Structure:=True, Windows:=False, Password:="password"
'Check to see if CANN Requests folder exists on Desktop
If Len(Dir(Environ("userprofile") & Application.PathSeparator & "Desktop" & Application.PathSeparator & "Requests", vbDirectory)) = 0 Then
'If not then create it
MkDir Environ("userprofile") & Application.PathSeparator & "Desktop" & Application.PathSeparator & "Requests"
End If
End Sub
PROBLEM #2 :::
When the original form is opened (and 'Enable Editing' button is clicked), it should also check to see if the /Requests/ folder is on the desktop and if not create the folder. This functionality is broken also.
PROBLEM #3 :::
Once the form is submitted by the original requestor, the form content becomes locked, and the form is sent via email to the next level for approval. The next Runtime Error 91 occurs when the approver opens the file from the email and selects 'Enable Editing'. Runtime Error 91: Object Variable or With block variable not set
PROBLEM #4 :::
When originally created the form contained 2 calendars based on the calendar control/date picker avail in 2007. As you know 2010 does not include a calendar control/date picker (my users are with SP1 and no admin rights on machines to D/L or register the new control 11.0 avail with SP4). In researching I found a Calendar Class solution that works with one small issue, it will not allow me to select today's date. When todays date is selected it places 00 jan 1900 in the field designated for the date. I thought that I had migrated everything from the 2007 Calendar Control to using the new Calendar Class, but must have done something wrong....(this is the Calendar Control Class that I integrated: https://sites.google.com/site/e90e50/calendar-control-class[/URL] )
This is the code on my UserForm1:
Code:
Option Explicit
'UserForm with Frame1
Private WithEvents Calendar2 As cCalendar
Private Sub Frame1_Click()
End Sub
Private Sub UserForm_Initialize()
Set Calendar2 = New cCalendar
With Calendar2
.HeaderBackColor = "&H80000000"
.SaturdayBackColor = "&H80000002"
.SundayBackColor = "&HFFAA99"
.DayFont = "Avant Garde"
.GridFont = "Avant Garde"
.TitleFont = "Arial Black"
.TitleFontColor = "&H80000011"
End With
Calendar2.Add_Calendar_into_Frame Me.Frame1
End Sub
Private Sub UserForm_Activate()
Calendar2.Value = Range("F4")
End Sub
Private Sub Calendar2_DblClick()
Sheet1.Unprotect Password:="password"
Range("F4") = Calendar2.Value + Time
Sheet1.Protect Password:="password"
Unload Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Set Calendar2 = Nothing
End Sub
Any assistance would be greatly appreciated and I hope that I have provided enough information and posted correctly, if not, please let me know and I will do what I can to help/correct.
THANK YOU!!!
VbANewbie13