How to use InputBox, accepting initial input and avoid the MsgBox.

  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


    I'm just getting how this one works. I don't want to start over. :)


    I think you're on to avoiding the InputBox popup, I'm just not sure on the last steps.


    Specifically these lines...


    Code
    Wb.SaveAs filename:=strFolder & strFile & intUnique & strExt 
    Wb.Close '


    And I think I get what you're doing here, just not 100% sure, how it works together and I know I can't leave it open because of the final step.

    Code
    Open strFolder & strFile & intUnique & strExt For Output As FileNum
  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


    This is getting anoying! lol


    I tried this below, with and commenting out

    Code
    OutFilePath = strFolder & strFile & intUnique & strExt


    And I'm still back to rt error 9 'subscript out of range'! @ Set wk = Worksheets(2)


    fwiw I would think this would cause a problem in the original macro since it's defined earlier as Set wk2 = Worksheets(2), but it doesn't. Only now.



  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


    This is the InputBox popup I'm trying to avoid.


    Code
    rply = InputBox("File " & fn1 & vbCrLf & "already exist, Would you like to change this file" & vbCrLf & "with following available name or change name as you like", "VCF File Name", pth & "\" & fn2 & ".vcf", vbOKCancel)
  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


    Same rt error 9 'subscript out of range' @ Set wk = Worksheets(2)


    Adding this code back in is the same too. I know I need this reference later either way. OutFilePath

    Code
    OutFilePath = strFolder & strFile & intUnique & strExt


    I don't know if it's because I'm normally using .CSV but you saw the original working code.


    Code
    fn1 = pth & "\" & fn1 & ".vcf"


    It definitely has to save as a .vcf not an .xls in the code above.

  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


    I don't know where that idea came from in the first place.


    I just tested our original code creating the vcf file from an .xls file rather than a .csv, and it worked perfectly.

  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


    Morning,
    The way is to increment the file number is to separate it in the routine. The do look will negate the input box

  • Re: How to use InputBox, accepting initial input and avoid the MsgBox.


    Thanks for your help! The code I added seems to work exactly as we need with the automatic filename increment. :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!