Hi all, I am using Access to grab some data from a database and plot a graph in Excel. When I do this, there is a message box in Excel that pop ups with an initialization error, that asks me to click ok - however the data that I want is already in the worksheet.
Is there a way to automate the "ok" so that I don't need click it every time I generate one of these sheets? I generate 13 at a time. I have tried the
application.DisplayAlerts = false
but it doesn't work. Any ideas? Thanks in advance!
5 6256
Hi, cloh.
Could you post your code (I guess)?
Hey, don't know if this will help (the code is very long and convoluted) but this is where I am trying to "hide" the messagebox... - Public Sub ProcessGUIClick(gui As Form, Optional destFolderPath As String)
-
Dim fdialog As FileDialog
-
Dim result As Integer
-
Dim gui As Form
-
Set gui = Form_LocbyCcy
-
Set fdialog = Application.FileDialog(msoFileDialogFolderPicker)
-
With fdialog
-
.AllowMultiSelect = False
-
.ButtonName = "Select"
-
If .Show = -1 Then
-
Excel.Application.DisplayAlerts = False
-
createGlobalCcys destFolderPath:=.SelectedItems(1)
-
createImpCcys destFolderPath:=.SelectedItems(1)
-
Excel.Application.DisplayAlerts = True
-
OpenChart39 destFolderPath:=.SelectedItems(1)
-
Call MakeCharts
-
End If
-
End With
-
End Sub
This is a sample of the "createGlobalccys" function - the "other createImpCcys" is similar: - Public Sub createGlobalCcys(Optional destFolderPath As String)
-
Dim xlapp As Excel.Application
-
Dim fso As New FileSystemObject
-
Dim newFolder As Folder
-
Dim Filename As String
-
Dim gui As Form
-
Dim Date1val As String
-
Dim Date2val As String
-
Dim Date1value As String
-
Dim Date2value As String
-
-
Set gui = Form_LocbyCcy
-
Date1val = gui.txt_FromDate.value
-
Date2val = gui.txt_ToDate.value
-
Date1value = DateAdd("d", -1, Date1val)
-
Date2value = DateAdd("d", 1, Date2val)
-
-
On Error Resume Next
-
Set xlapp = New Excel.Application
-
If Err <> 0 Then
-
MsgBox "Could not start Excel", vbExclamation
-
GoTo createGlobalCcys_err
-
End If
-
-
If Not fso.FolderExists(destFolderPath) Then
-
MsgBox "Could find the specified folder!", vbExclamation
-
GoTo createGlobalCcys_err
-
Else
-
Set newFolder = fso.GetFolder(destFolderPath)
-
End If
-
-
On Error GoTo createGlobalCcys_err
-
-
Filename = fso.BuildPath(newFolder.path, "GlobalCcys.xls")
-
-
CreateGlobalChart graphTypeID:=1, Date1:=Date1value, Date2:=Date2value, _
-
Filename:=Filename, xlAppRef:=xlapp
-
-
createGlobalCcys_exit:
-
Exit Sub
-
createGlobalCcys_err:
-
MsgBox Err.Description
-
Resume Next
-
End Sub
Sorry guys, with regards to this post basically all I need help with is the VB code to dismiss a msgbox. Any ideas?
Oh yeah, Happy Thanksgiving in advance!
Several points: - are you sure the message is thrown by Excel ?
- if you want to run method / set property of some particular object you should reference the object implicitely, code like
Excel.Application.DisplayAlerts ....
has a little chance to take an effect on your particular application instance - you should localize code line throwing the error, if you have difficulties debugging code then take a look at WIP: Debugging in VBA article
- there is no simple method to close messagebox
P.S. Happy Thanksgiving.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ian justice |
last post by:
Before i post actual code, as i need a speedyish reply.
Can i first ask if anyone knows off the top of their head, if there is
a likely obvious cause to the following problem.
For the moment i've...
|
by: Jacob Larsen |
last post by:
Is <select name="var"> ok according to w3.org?
Regards Jacob
|
by: Will Hartung |
last post by:
Can someone clarify that multiple classes in the "class" attribute are ok
and "legal" and not some fluke?
So, I can do:
..pink {color: pink}
..bold {font-weight: bold}
..medium {font-size:...
|
by: Gaz |
last post by:
Hey. I looked at the Sendmail help and did not find a property where i
can get an "ok" signal when the email is finally sent. I need something
like that to show a "Processing, please stand by"...
|
by: Rich |
last post by:
I have a simple vb2005 app (for testing). It is just a simple winform with
one button that brings up a message box. When I invoke the app and click on
the button, the message box comes up OK. ...
|
by: shaizaban |
last post by:
hello,
my question is as follows (very urgent):
i generated in an aspx page a modalpopup ajax control.
i inserted a user control into the panel contained in the popup
control.
the panel contains...
|
by: Lowrider |
last post by:
I'm new to the VB programming world and am having a problem with flow control. In the code below I check 3 textboxes and display a messagebox if one or more are left blank. The problem lies in that...
|
by: Claus Mygind |
last post by:
Is there a newer version of javaScript that will allow other text on the confirm dialogue box in place of "Ok" and "Cancel" Specifically for FireFox. I know that I can use visual basic for internet...
|
by: jalpari |
last post by:
hi all,
i have created a form in which i have a button for searching records from database, when a record is found it'z displayed in the table fields and whenever the record'z not found it displays...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |