switchboard

  • Thread starter Thread starter David M. Fizer
  • Start date Start date
D

David M. Fizer

Hello,


Is it possible to open a word document or excel spreadsheet using the
switchboard in access?



TIA,
David
 
Hi David,

The short answer to your question is "Yes", it is possible. What's not so
obvious from your question is are you using a switchboard that was created
using the Switchboard wizard, or one that you created yourself (ie. an
unbound form)? Also, are you wanting a button that opens the same Word
doucment every time, or just Word so that you can select the file to open?


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hello,

Is it possible to open a word document or excel spreadsheet using the
switchboard in access?


TIA,
David
 
Hello Tom

Yes I would be using a switchboard that was created by the wizard but if
necessary to get it to work I would create my own. I have a couple of
documents already made and would just want to use a button or two on
switchboard to open each of them or atleast take the user to the folder
where they are stored.

Thanks you,
David
 
Hi David,

Here is a simple example for opening a hard-coded Word document. First, open
the switchboard manager wizard and add a new command: Run Code. Use a
Function Name such as: OpenWordDoc. (If you use a different name, then make
a note of the new name). Then exit the switchboard wizard.

Create a new module. Copy and paste the following code into this module:

'****************BEGIN CODE*********************

Option Compare Database
Option Explicit

Public Sub OpenWordDoc()
On Error GoTo ProcError

Dim oApp As Object
Dim oDoc As Object
Dim strDocName As String

strDocName = "Full path to your Word document"

Set oApp = CreateObject("Word.Application")
Set oDoc = oApp.Documents.Open(fileName:=strDocName)
oApp.Visible = True



ExitProc:
Exit Sub
ProcError:
MsgBox "Error " & Err.Number & ": " & Err.Description, _
vbCritical, "Error in procedure OpenWordDoc..."
Resume ExitProc

End Sub

'****************END CODE*********************

The strDocName string variable defines the full path (ie. path + filename)
to your document. This is why I termed it "hard-coded". For example:

strDocName = "C:\Documents and Settings\UserName\My Documents\MyDoc.doc"

This is just a start. You can also use a command button on your switchboard
to open a new form, which includes a listbox with several Word documents
listed. This form would have a command button that would open whatever Word
document was selected in the listbox (you'd want to set the Multi Select
property to None, so that the user could select only one Word document at a
time). Then you pass the full path of the selected document file into the
function as a parameter.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hello Tom

Yes I would be using a switchboard that was created by the wizard but if
necessary to get it to work I would create my own. I have a couple of
documents already made and would just want to use a button or two on
switchboard to open each of them or atleast take the user to the folder
where they are stored.

Thanks you,
David
__________________________________________

Tom Wickerath wrote:

Hi David,

The short answer to your question is "Yes", it is possible. What's not so
obvious from your question is are you using a switchboard that was created
using the Switchboard wizard, or one that you created yourself (ie. an
unbound form)? Also, are you wanting a button that opens the same Word
doucment every time, or just Word so that you can select the file to open?


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Hello,

Is it possible to open a word document or excel spreadsheet using the
switchboard in access?


TIA,
David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Access Switchboard error message 1
Logical Statement on a SwitchBoard Menu. 7
SWITCHBOARD 1
switchboard problem 4
Switchboard Minimized 4
Switchboard Questions 2
Where is the startup manager in 2007 2
I've lost my Switchboard ! 3

Back
Top