Hello Admin,
receive and now everything is fine.
if you can tell me where wrong with putting the path to my folder because everything I saved on the desktop, but I want to ask him a path to my folder. I'll show you what I do, but I do not get things right.
Code:Option Explicit Sub kTest() Dim strDesktopFolder As String Dim strCity As String Dim wbkActive As Workbook Dim wbkNew As Workbook Dim strFName As String strDesktopFolder = CreateObject("WScript.Shell").Specialfolders(10) strCity = ThisWorkbook.Worksheets("Sheet2").Range("c5") 1: If CBool(Len(Dir(strDesktopFolder & "\" & strCity, vbDirectory))) Then Set wbkActive = ThisWorkbook Set wbkNew = Workbooks.Add(xlWBATWorksheet) wbkActive.Worksheets(Array("Sheet2", "Sheet3")).Copy before:=wbkNew.Worksheets(1) strFName = Application.InputBox("File Name", "FileName", Type:=2) wbkNew.SaveAs strDesktopFolder & "C:\Users\dracon_\Desktop\Countries" & strCity & "\" & strFName, 51'I put my path to the folder but does ' not want to get probably ' wrong again!? Please help me. ' My heartfelt thanks! wbkNew.Close 0 Set wbkNew = Nothing Else If MsgBox("Folder '" & strDesktopFolder & "\" & strCity & "' does not exist." & vbLf & _ "Do you want create the folder?", vbYesNo) = vbYes Then MkDir strDesktopFolder & "\" & strCity GoTo 1 Else Exit Sub End If End If End Sub




Reply With Quote

Bookmarks