Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › Visual Basic Programming › [Help] Open a file automatically [VB6] [solved]

Exclamation[Help] Open a file automatically [VB6] [solved]

Posts 1–15 of 39 · Page 1 of 3
lelelololele
lelelololele
[Help] Open a file automatically [VB6] [solved]
Hello, I am trying to find a way that when I push a button in Visual Basic, a file will open.
I have tried this code ( Dim RetVal
RetVal = Shell("C:\Users\User\Desktop\Mp3cyprusmaniacs_cont est\ini.bat", vbWindowState) ) and it works fine, but it is with a path..and when the file is not there, a message pops up with "error 53 - file not found"..
I would like to know if there is a way to open that file without using any path..
Thanks
#1 · 15y ago
JU
justiman
uh just add a openfiledialog and add a button and double click on the button and type:


OpenFileDialog1.showdialog




its that simple lol
#2 · 15y ago
lelelololele
lelelololele
can you tell me what to do in more details because it is my first day in vb6? :P @justiman
#3 · 15y ago
JU
justiman
vb6? the code i have dont work for vb6... get vb 2010 its ALOT better. then do what i said and there you go... or i could make it for you and send it to you
#4 · 15y ago
edub18
edub18
So you want to select a file and open it?
Its easy! You need a CommonDialogControl

Code:
With CommonDialog1
    .FileName = ""
    .ShowOpen
    
    If .FileName <> "" Then
        RetVal = Shell("CommonDialog1.FileName", vbWindowState)
    End If
End With
#5 · 15y ago
JU
justiman
Quote Originally Posted by Vanoq View Post
So you want to select a file and open it?
Its easy! You need a CommonDialogControl

Code:
With CommonDialog1
    .FileName = ""
    .ShowOpen
    
    If .FileName <> "" Then
        RetVal = Shell("CommonDialog1.FileName", vbWindowState)
    End If
End With
my way is easier...
#6 · 15y ago
lelelololele
lelelololele
will this work for vb6? @Vanoq
#7 · 15y ago
JU
justiman
Quote Originally Posted by lelelololele View Post
will this work for vb6? @Vanoq
i can just make one for you in like 30 seconds and send it to you
#8 · 15y ago
lelelololele
lelelololele
do you mean make a form in VB6 with a button which opens a file?
#9 · 15y ago
Margherita
Margherita
Quote Originally Posted by justiman View Post
i can just make one for you in like 30 seconds and send it to you
He wants to learn himself, he doesn't want to just take something he didn't make
#10 · 15y ago
edub18
edub18
Quote Originally Posted by lelelololele View Post
will this work for vb6? @Vanoq
Of course. My snippet is VB6
#11 · 15y ago
JU
justiman
Quote Originally Posted by lelelololele View Post
do you mean make a form in VB6 with a button which opens a file?
yea thats what you do o.0
#12 · 15y ago
lelelololele
lelelololele
hmmm...I don't know..something is wrong here -.-
Code:
Private Sub Command1_Click()
With CommonDialog1
    .FileName = "ini.bat"
    .ShowOpen
    
    If .FileName <> "ini.bat" Then
        RetVal = Shell("CommonDialog1.FileName", vbWindowState)
    End If
End With
End Sub
what did I do wrong?
#13 · 15y ago
edub18
edub18
Dont change the filename. You can use the code as i posted it.

Code:
.Filename = ""
#14 · 15y ago
lelelololele
lelelololele
sry for being so annoying, but, I am a newbie in vb6
so, i just create a button and put this code?
Code:
rivate Sub Command1_Click()
With CommonDialog1
    .FileName = ""
    .ShowOpen
    
    If .FileName <> "" Then
        RetVal = Shell("CommonDialog1.FileName", vbWindowState)
    End If
End With
End Sub
if yes, there is an error..
#15 · 15y ago
Posts 1–15 of 39 · Page 1 of 3

Post a Reply

Tags for this Thread

None