Opening excel files

I need to find code that will open up an excel file that has a password, and let a user edit it. I don't want VB to do anything except actually launch excel by means of shell or something similiar, and have the password automatically entered. Any suggestions would be appreciated.

Comments

  • : I need to find code that will open up an excel file that has a password, and let a user edit it. I don't want VB to do anything except actually launch excel by means of shell or something similiar, and have the password automatically entered. Any suggestions would be appreciated.
    :
    Not sure but you may try sometjing like this
    [code]
    Dim objExcel As Excel.Application
    Dim objWorkBook As Workbook
    Dim strPasword As String
    strPassword = InputBox("Please Enter Password", "Password")
    Set objExcel = CreateObject("EXCEL.APPLICATION")
    Set objWorkBook = objExcel.Workbooks.Open("C:Test est2.xls", , , , strPassword)' Check for password
    objWorkBook.SaveAs ("C:Test est3.xls")
    objWorkBook.Close
    Set objWorkBook = Nothing
    objExcel.Quit
    Set objExcel = Nothing
    [/code]
  • I have the following:

    [code]
    Dim objExcel As Excel.Application
    Dim objWorkBook As Workbook
    Dim strPasword As String
    Set objExcel = CreateObject("EXCEL.APPLICATION")
    Set objWorkBook = objExcel.Workbooks.Open("C:IntakeExcel Template emplate_excel.xls", , , , "mypassword") ' Check for password
    [/code]

    This does open the file, however, I dont wish to edit anything in VB, only use VB to open the excel sheet. After that, I need for the Excel sheet to remain open and editable manually by the user




    : : I need to find code that will open up an excel file that has a password, and let a user edit it. I don't want VB to do anything except actually launch excel by means of shell or something similiar, and have the password automatically entered. Any suggestions would be appreciated.
    : :
    : Not sure but you may try sometjing like this
    : [code]
    : Dim objExcel As Excel.Application
    : Dim objWorkBook As Workbook
    : Dim strPasword As String
    : strPassword = InputBox("Please Enter Password", "Password")
    : Set objExcel = CreateObject("EXCEL.APPLICATION")
    : Set objWorkBook = objExcel.Workbooks.Open("C:Test est2.xls", , , , strPassword)' Check for password
    : objWorkBook.SaveAs ("C:Test est3.xls")
    : objWorkBook.Close
    : Set objWorkBook = Nothing
    : objExcel.Quit
    : Set objExcel = Nothing
    : [/code]
    :

  • : I have the following:
    :
    : [code]
    : Dim objExcel As Excel.Application
    : Dim objWorkBook As Workbook
    : Dim strPasword As String
    : Set objExcel = CreateObject("EXCEL.APPLICATION")
    : Set objWorkBook = objExcel.Workbooks.Open("C:IntakeExcel Template emplate_excel.xls", , , , "mypassword") ' Check for password
    [blue]objWorkBook.Visible = True[/blue]
    : [/code]
    :
    : This does open the file, however, I dont wish to edit anything in VB, only use VB to open the excel sheet. After that, I need for the Excel sheet to remain open and editable manually by the user
    :
    To do that add line off code colored as blue to your code. It will be also good to have code like that somewere, may be in Form Unload event
    [code]
    Set objWorkBook = Nothing
    objExcel.Quit
    Set objExcel = Nothing
    [/code]

  • It works, but I need to change the blue code, I believe it should be

    [code]
    objExcel.Visible = True
    [/code]

    Thanks for the help

    : : I have the following:
    : :
    : : [code]
    : : Dim objExcel As Excel.Application
    : : Dim objWorkBook As Workbook
    : : Dim strPasword As String
    : : Set objExcel = CreateObject("EXCEL.APPLICATION")
    : : Set objWorkBook = objExcel.Workbooks.Open("C:IntakeExcel Template emplate_excel.xls", , , , "mypassword") ' Check for password
    : [blue]objWorkBook.Visible = True[/blue]
    : : [/code]
    : :
    : : This does open the file, however, I dont wish to edit anything in VB, only use VB to open the excel sheet. After that, I need for the Excel sheet to remain open and editable manually by the user
    : :
    : To do that add line off code colored as blue to your code. It will be also good to have code like that somewere, may be in Form Unload event
    : [code]
    : Set objWorkBook = Nothing
    : objExcel.Quit
    : Set objExcel = Nothing
    : [/code]
    :
    :

  • : It works, but I need to change the blue code, I believe it should be
    :
    : [code]
    : objExcel.Visible = True
    : [/code]
    :
    Yes. That's right.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion