Home All Groups Group Topic Archive Search About

Open Excel when user press OK button

Author
27 Feb 2007 2:03 PM
Anna
Hi: This is the message box which shows that the file is save in the
my document folder with the file name. Can any one please tell me how
to i create another message box with OK Cancel button and with the
message "Do you want to open that excel file" If user press Ok it open
the excel with that file and if user press cancel it will be stay in
the current form.

MsgBox "Your document is in My Documents with the name 'Accounts-
Distribution " & Format$(Date, "yyyymmdd") & "-" &

Format$(Time, "hhmmss") & "-" & maxbatchID & ".xls'"

Thanks.

Author
27 Feb 2007 2:22 PM
Bob Butler
"Anna" <colleen1***@gmail.com> wrote in message
news:1172585026.018293.133790@a75g2000cwd.googlegroups.com
> Hi: This is the message box which shows that the file is save in the
> my document folder with the file name. Can any one please tell me how
> to i create another message box with OK Cancel button and with the
> message "Do you want to open that excel file" If user press Ok it open
> the excel with that file and if user press cancel it will be stay in
> the current form.
>

dim sMsg as string
sMsg="Open the document in My Documents with the name " & _
  "'Accounts-Distribution " & Format$(Date, "yyyymmdd") & "-" & _
  Format$(Time, "hhnnss") & "-" & maxbatchID & ".xls'?"
If vbYes=Msgbox(sMsg,vbYesNo,"Confirm selection") Then
  ' open document
Else
  ' don't
End If


--
Reply to the group so all can participate
VB.Net: "Fool me once..."
Author
27 Feb 2007 2:54 PM
Sinna
Anna wrote:
> Hi: This is the message box which shows that the file is save in the
> my document folder with the file name. Can any one please tell me how
> to i create another message box with OK Cancel button and with the
> message "Do you want to open that excel file" If user press Ok it open
> the excel with that file and if user press cancel it will be stay in
> the current form.
>
> MsgBox "Your document is in My Documents with the name 'Accounts-
> Distribution " & Format$(Date, "yyyymmdd") & "-" &
>
> Format$(Time, "hhmmss") & "-" & maxbatchID & ".xls'"
>
> Thanks.
>
See Bob's post.

To open the Excel-file, you can google for the ShellExecute API
function. Using this function makes sure you open the xls-file with the
application the user has selected to deal with it (can be OpenOffice
too...).

Sinna