Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
  • Avatar do usuário
#32789
Boa noite.

Veja se atende:
Código: Selecionar todos
fileToOpen = Application _ 
 .GetOpenFilename("Text Files (*.txt), *.txt") 
If fileToOpen <> False Then 
 MsgBox "Open " &; fileToOpen 
End If
Fonte:

https://msdn.microsoft.com/en-us/vba/ex ... thod-excel
#32790
Não deu Certo, Mas consigui pesquisando mais um pouco, porem ainda tenho uma duvida. vou postar o codigo.
Código: Selecionar todos
Sub Importar_estoque()
Dim SelectedFile As String

With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Title = "Select file"
.ButtonName = "Confirm"
.InitialFileName = "C:\"
If .Show = -1 Then
'ok clicked
SelectedFile = .SelectedItems(1)
MsgBox SelectedFile
Else
'cancel clicked
End If

End With

Workbooks.Open (SelectedFile)

    Columns("A:A").Select
    Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
        FieldInfo:=Array(Array(0, 1), Array(6, 1), Array(10, 1), Array(35, 1), Array(95, 1), _
        Array(99, 1), Array(103, 1)), TrailingMinusNumbers:=True
    Cells.Select
    Cells.EntireColumn.AutoFit
    Columns("D:D").Select
    Selection.Delete Shift:=xlToLeft
    Range("B9:E1382").Select
    Selection.Copy
    Windows("Banco de Dados.xlsm").Activate
    Sheets("ESTOQUE LIXO").Select
    Range("B3").Select
    ActiveSheet.Paste
    Sheets("Painel").Select
    Range("J20").Select
         
    
End Sub
Como faço pra fechar o arquivo que a aplicação abriu uma vez que esse arquivo é renomeado todos os dias .
exemplo o arquivo que abrir tem a data 05/05/2018 amanha já vai ser 06/06/2018 e assim por diante
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord