Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default type mismatch on saving excel calculation mode via VB app

Well, I'm just plain stumped. I get type mismatch errors early on trying to
save the calculation mode of excel object and a different error when trying
to set it to manual:

Dim CalculationMode As Variant
Private StatusBarSetting As Boolean
Dim xl As Excel.Application
Dim Argv As Variant

Sub Main()
Dim n As Integer
Dim sArgv As String

Argv = Parse_Args(5)
sArgv = ""
For n = 1 To UBound(Argv)
sArgv = sArgv & Argv(n) & vbCrLf
Next n
MsgBox "Arguments found: " & vbCrLf & sArgv
Start_Excel
Quit_Excel
End Sub

Private Sub Start_Excel()
Set xl = CreateObject("Excel.Application")
If Err.Number < 0 Then End
Call SaveSettings
End Sub

Private Sub Quit_Excel()
RestoreSettings
xl.Quit
Set xl = Nothing
End Sub

Private Sub SaveSettings()
'On Error Resume Next
If xl Is Nothing Then
MsgBox "Internal error!!! xl is Nothing!"
End
End If
xl.Interactive = False
xl.AskToUpdateLinks = False
CalculationMode = xl.Calculation <<-- type mismatch error on this
statement but don't know why.
xl.Calculation = xlCalculationManual <<- error 1004 on this
statement, "Method 'Calculation' of object '_Application' failed and don't
know why
StatusBarSetting = xl.DisplayStatusBar
xl.DisplayAlerts = False
xl.Cursor = xlWait
xl.ScreenUpdating = False
xl.DisplayStatusBar = True
End Sub


Ken Shaffer



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default type mismatch on saving excel calculation mode via VB app

Check your post in .misc.

Ken Shaffer wrote:

Well, I'm just plain stumped. I get type mismatch errors early on trying to
save the calculation mode of excel object and a different error when trying
to set it to manual:

Dim CalculationMode As Variant
Private StatusBarSetting As Boolean
Dim xl As Excel.Application
Dim Argv As Variant

Sub Main()
Dim n As Integer
Dim sArgv As String

Argv = Parse_Args(5)
sArgv = ""
For n = 1 To UBound(Argv)
sArgv = sArgv & Argv(n) & vbCrLf
Next n
MsgBox "Arguments found: " & vbCrLf & sArgv
Start_Excel
Quit_Excel
End Sub

Private Sub Start_Excel()
Set xl = CreateObject("Excel.Application")
If Err.Number < 0 Then End
Call SaveSettings
End Sub

Private Sub Quit_Excel()
RestoreSettings
xl.Quit
Set xl = Nothing
End Sub

Private Sub SaveSettings()
'On Error Resume Next
If xl Is Nothing Then
MsgBox "Internal error!!! xl is Nothing!"
End
End If
xl.Interactive = False
xl.AskToUpdateLinks = False
CalculationMode = xl.Calculation <<-- type mismatch error on this
statement but don't know why.
xl.Calculation = xlCalculationManual <<- error 1004 on this
statement, "Method 'Calculation' of object '_Application' failed and don't
know why
StatusBarSetting = xl.DisplayStatusBar
xl.DisplayAlerts = False
xl.Cursor = xlWait
xl.ScreenUpdating = False
xl.DisplayStatusBar = True
End Sub

Ken Shaffer


--

Dave Peterson
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
type mismatch on saving excel calculation mode via VB app Ken Shaffer Excel Discussion (Misc queries) 3 November 2nd 05 01:51 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Type Mismatch Jack Schitt Excel Programming 2 September 3rd 04 11:55 AM
Excel VBA - Type mismatch during While sub_pop Excel Programming 5 July 23rd 04 11:42 PM
Type mismatch Alan Beban[_4_] Excel Programming 0 February 4th 04 08:39 PM


All times are GMT +1. The time now is 07:33 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"