PC Review


Reply
Thread Tools Rate Thread

Disable Excel Macro warning?

 
 
Rich Wallace
Guest
Posts: n/a
 
      20th Feb 2004
Is there a way to open an Excel file and either respond to or supress the
Macro warning window via VB.NET?

Dim oExcel As Excel.Workbook

Dim sFilePath As String = "C:\DailyReport.xls"

oExcel = GetObject(sFilePath) --> Throws Macro warning window
oExcel.Unprotect("password")

Try
cnExcel.Open()
cnExcel.Close()
Catch ex As Exception
MsgBox(ex.Message)
Finally
oExcel.Close()
End Try

Thanks,
-Rich


 
Reply With Quote
 
 
 
 
Jorge
Guest
Posts: n/a
 
      20th Feb 2004
Hello Rich
I use the following approach Book = Books.Open(file) and
i never recived any macro warning.

Kind Regards
Jorge

>-----Original Message-----
>Is there a way to open an Excel file and either respond

to or supress the
>Macro warning window via VB.NET?
>
> Dim oExcel As Excel.Workbook
>
> Dim sFilePath As String = "C:\DailyReport.xls"
>
> oExcel = GetObject(sFilePath) --> Throws Macro

warning window
> oExcel.Unprotect("password")
>
> Try
> cnExcel.Open()
> cnExcel.Close()
> Catch ex As Exception
> MsgBox(ex.Message)
> Finally
> oExcel.Close()
> End Try
>
>Thanks,
>-Rich
>
>
>.
>

 
Reply With Quote
 
Rich Wallace
Guest
Posts: n/a
 
      20th Feb 2004
Forgive me, what namespace do I use to access the Books class?

"Jorge" <(E-Mail Removed)> wrote in message
news:134bf01c3f7ca$3d9b53b0$(E-Mail Removed)...
> Hello Rich
> I use the following approach Book = Books.Open(file) and
> i never recived any macro warning.
>
> Kind Regards
> Jorge
>
> >-----Original Message-----
> >Is there a way to open an Excel file and either respond

> to or supress the
> >Macro warning window via VB.NET?
> >
> > Dim oExcel As Excel.Workbook
> >
> > Dim sFilePath As String = "C:\DailyReport.xls"
> >
> > oExcel = GetObject(sFilePath) --> Throws Macro

> warning window
> > oExcel.Unprotect("password")
> >
> > Try
> > cnExcel.Open()
> > cnExcel.Close()
> > Catch ex As Exception
> > MsgBox(ex.Message)
> > Finally
> > oExcel.Close()
> > End Try
> >
> >Thanks,
> >-Rich
> >
> >
> >.
> >



 
Reply With Quote
 
Jorge
Guest
Posts: n/a
 
      20th Feb 2004
Rich,

Dim objExcel As Excel.Application
Dim Books As Excel.Workbooks
Dim Book As Excel.Workbook
Dim Sheet As Excel.Worksheet

objExcel = New Excel.Application
objExcel.Visible = True
Books = objExcel.Workbooks

Book = Books.Open(file)

Sheet = CType(Book.Worksheets(1), Excel.Worksheet)

DirectCast(Book.Sheets("Sheet1"),
Excel.Worksheet).Activate()


Sheet = DirectCast(Book.ActiveSheet, Excel.Worksheet)


Jorge
>-----Original Message-----
>Forgive me, what namespace do I use to access the Books

class?
>
>"Jorge" <(E-Mail Removed)> wrote in

message
>news:134bf01c3f7ca$3d9b53b0$(E-Mail Removed)...
>> Hello Rich
>> I use the following approach Book = Books.Open(file)

and
>> i never recived any macro warning.
>>
>> Kind Regards
>> Jorge
>>
>> >-----Original Message-----
>> >Is there a way to open an Excel file and either

respond
>> to or supress the
>> >Macro warning window via VB.NET?
>> >
>> > Dim oExcel As Excel.Workbook
>> >
>> > Dim sFilePath As String = "C:\DailyReport.xls"
>> >
>> > oExcel = GetObject(sFilePath) --> Throws Macro

>> warning window
>> > oExcel.Unprotect("password")
>> >
>> > Try
>> > cnExcel.Open()
>> > cnExcel.Close()
>> > Catch ex As Exception
>> > MsgBox(ex.Message)
>> > Finally
>> > oExcel.Close()
>> > End Try
>> >
>> >Thanks,
>> >-Rich
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
Rich Wallace
Guest
Posts: n/a
 
      20th Feb 2004
Duh. Sorry about that. That worked like a champ!!!

Thank you sir!

"Jorge" <(E-Mail Removed)> wrote in message
news:140cd01c3f7cd$62a913b0$(E-Mail Removed)...
> Rich,
>
> Dim objExcel As Excel.Application
> Dim Books As Excel.Workbooks
> Dim Book As Excel.Workbook
> Dim Sheet As Excel.Worksheet
>
> objExcel = New Excel.Application
> objExcel.Visible = True
> Books = objExcel.Workbooks
>
> Book = Books.Open(file)
>
> Sheet = CType(Book.Worksheets(1), Excel.Worksheet)
>
> DirectCast(Book.Sheets("Sheet1"),
> Excel.Worksheet).Activate()
>
>
> Sheet = DirectCast(Book.ActiveSheet, Excel.Worksheet)
>
>
> Jorge
> >-----Original Message-----
> >Forgive me, what namespace do I use to access the Books

> class?
> >
> >"Jorge" <(E-Mail Removed)> wrote in

> message
> >news:134bf01c3f7ca$3d9b53b0$(E-Mail Removed)...
> >> Hello Rich
> >> I use the following approach Book = Books.Open(file)

> and
> >> i never recived any macro warning.
> >>
> >> Kind Regards
> >> Jorge
> >>
> >> >-----Original Message-----
> >> >Is there a way to open an Excel file and either

> respond
> >> to or supress the
> >> >Macro warning window via VB.NET?
> >> >
> >> > Dim oExcel As Excel.Workbook
> >> >
> >> > Dim sFilePath As String = "C:\DailyReport.xls"
> >> >
> >> > oExcel = GetObject(sFilePath) --> Throws Macro
> >> warning window
> >> > oExcel.Unprotect("password")
> >> >
> >> > Try
> >> > cnExcel.Open()
> >> > cnExcel.Close()
> >> > Catch ex As Exception
> >> > MsgBox(ex.Message)
> >> > Finally
> >> > oExcel.Close()
> >> > End Try
> >> >
> >> >Thanks,
> >> >-Rich
> >> >
> >> >
> >> >.
> >> >

> >
> >
> >.
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Enable/Disable Pop-Up Warning juamig Microsoft Excel Misc 2 8th Apr 2010 11:37 PM
Can I disable Outlook warning from Excel macro "Send" method wpiet Microsoft Outlook VBA Programming 14 7th Jan 2009 12:54 PM
disable macro warning Rose Microsoft Excel Misc 7 30th Dec 2004 05:57 PM
Re: Disable Macro Warning Valerie Microsoft Excel Discussion 0 8th Sep 2003 03:34 PM
Re: Disable Macro Warning Rafael Ortiz Microsoft Excel Discussion 1 5th Sep 2003 08:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:56 AM.