+ Reply to Thread
Results 1 to 2 of 2

Type Mismatch Error when using InputBox Method

  1. #1
    Anolan
    Guest

    Type Mismatch Error when using InputBox Method

    I'm getting a Type Mismatch error and the macro stops at Set myDir (see ERROR
    > below). Since I'm using a string of numbers, letters and symbols, I

    thought I would select the type as 2 for text. Please help!

    Dim myCell, myRange, myDir, myDateTime
    Set myRange = Application.InputBox(prompt:="Enter a Range", Type:=8)
    ERROR > Set myDir = Application.InputBox(prompt:="Enter File Location",
    Default:="U:\CC EB 500 Reports\mmddyy\", Type:=2)
    Set myDateTime = Application.InputBox(prompt:="Enter Date and Time",
    Default:="mm/dd/yy hh:mm am", Type:=2)
    Windows("PERSONAL.XLS").Visible = True
    Workbooks("Personal.xls").Activate
    Sheets("Sheet1").Select
    For Each myCell In myRange
    Workbooks.Open Filename:=myFile.Text & myCell.Value


  2. #2
    Toppers
    Guest

    RE: Type Mismatch Error when using InputBox Method

    Hi,

    Remove Set from MyDir and MydateTime


    myDir = Application.InputBox(prompt:="Enter File Location", ....

    HTH

    "Anolan" wrote:

    > I'm getting a Type Mismatch error and the macro stops at Set myDir (see ERROR
    > > below). Since I'm using a string of numbers, letters and symbols, I

    > thought I would select the type as 2 for text. Please help!
    >
    > Dim myCell, myRange, myDir, myDateTime
    > Set myRange = Application.InputBox(prompt:="Enter a Range", Type:=8)
    > ERROR > Set myDir = Application.InputBox(prompt:="Enter File Location",
    > Default:="U:\CC EB 500 Reports\mmddyy\", Type:=2)
    > Set myDateTime = Application.InputBox(prompt:="Enter Date and Time",
    > Default:="mm/dd/yy hh:mm am", Type:=2)
    > Windows("PERSONAL.XLS").Visible = True
    > Workbooks("Personal.xls").Activate
    > Sheets("Sheet1").Select
    > For Each myCell In myRange
    > Workbooks.Open Filename:=myFile.Text & myCell.Value
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1